Community
cancel
Showing results for 
Search instead for 
Did you mean: 
aminer10
Beginner
26 Views

Parallel compression version 1.21 ...


Hello,


I have updated my parallel compression library to version 1.21 ,

in the GzipCompress() i have done something like this:

-------------------------------
1 - if count_compress = Tjob(obj).index
2- then
3- begin
4-
5- bzip.compressStream(Tjob(obj).stream,local_stream);
6- local_stream.position:=0;
7- Tjob(obj).fstream.CopyFrom(local_stream,local_stream.size);
8- count_compress:=count_compress+1;
9- local_count:=count_compress;
10- break;
11- end;
12- until false ;
------------------------------------------------


But there is a race condition , since between line 8 and 9 a
thread may modify count_compress and you can get a corrupt
information in line 9.


I have corrected it with something like this:

-------------------------------
if count_compress = Tjob(obj).index
then
begin

bzip.compressStream(Tjob(obj).stream,local_stream);
local_stream.position:=0;
Tjob(obj).fstream.CopyFrom(local_stream,local_stream.size);
local_count:=count_compress+1;
count_compress:=local_count;
break;
end;
until false ;
------------------------------------------------

And you can download the new updated version from:

http://pages.videotron.com/aminer/


Sincerely,
Amine Moulay Ramdane.

0 Kudos
0 Replies