develooper Front page | perl.perl5.porters | Postings from July 2008

XS, multiple embedded interpreters & one time initialization

Milosz Tanski
July 16, 2008 08:14
XS, multiple embedded interpreters & one time initialization
Message ID:
Does Perl provide any facility, along the lines of pthread_once, that
can guarantee that a piece of code will only get run once; for code like
the initialization of an external libraries' static vars? The boot
section of the XS module is called each time an (embedded) interpreter
loads the module so that's not really a suitable spot. Alternatively, is
there there a way to statically initialize a perl_mutex, ala assigning
PTHREAD_MUTEX_INITIALIZER to a real pthread_mutex, that will work for
all the platforms that Perl supports threading?
The module I'm working with is XML::Xerces, which is a wrapper around
the apache project's xerces-c library. It has a few thread safety issues
that I'm working to solve.
-- Milosz Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About