Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avoid re-entrancy into libtiff using the mutex api
- Loading branch information
Showing
7 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,3 +143,4 @@ i_tiff_has_compression(name) | |
|
||
BOOT: | ||
PERL_INITIALIZE_IMAGER_CALLBACKS; | ||
i_tiff_init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/largish.tif |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!perl -w | ||
use strict; | ||
use threads; | ||
use Imager; | ||
|
||
++$|; | ||
Imager->preload; | ||
|
||
# as a TIFF this file is large, build it from largeish.jpg if it | ||
# doesn't exist | ||
unless (-f "bench/largish.tif") { | ||
my $im = Imager->new(file => "bench/largish.jpg") | ||
or die "Cannot read bench/largish.jpg:", Imager->errstr; | ||
$im->write(file => "bench/largish.tif") | ||
or die "Cannot write bench.largish.tif:", $im->errstr; | ||
} | ||
|
||
my @tests = | ||
( | ||
[ "bench/largish.tif", "" ], | ||
[ "TIFF/testimg/grey16.tif", "" ], | ||
[ "TIFF/testimg/comp4bad.tif", "(Iolayer): Read error at scanline 120; got 0 bytes, expected 32" ], | ||
); | ||
|
||
my @threads; | ||
my $name = "A"; | ||
for my $test (@tests) { | ||
push @threads, | ||
threads->create | ||
( | ||
sub { | ||
my ($file, $result, $name) = @_; | ||
for (1 .. 100000) { | ||
print $name; | ||
my $im = Imager->new(file => $file); | ||
if ($result) { | ||
$im and die "Expected error from $file, got image"; | ||
Imager->errstr eq $result | ||
or die "Expected error '$result', got '",Imager->errstr, "'" | ||
} | ||
else { | ||
$im or die "Expected image got error '", Imager->errstr, "'"; | ||
} | ||
} | ||
return; | ||
}, | ||
@$test, | ||
$name | ||
); | ||
++$name; | ||
} | ||
|
||
for my $t (@threads) { | ||
$t->join(); | ||
} |