Hi,
I'm the author of a perl XS module which is a wrapper around
a C++ library that is thread-safe. However in the
context of Perl is doesn't seem to be.
When I do the following:
===============================
#!/usr/bin/perl
use Lucene;
use threads;
use strict;
my $analyzer = new Lucene::Analysis::Standard::StandardAnalyzer;
sub test {
print "pass\n";
};
my $thr = threads->create('test');
$thr->join();
undef $analyzer;
print "pass2\n";
exit(0);
===============================
I get:
pass
Segmentation fault
It seems there is a problem during the destruction of the
object that was created before threads->create. What
could be the cause of this problem ?
The source code of the XS module is here:
http://search.cpan.org/src/TBUSCH/Lucene-0.13/
What are the usual things to look out for when
writing thread-safe XS modules that use external
libraries ?
Thomas.