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

XS, multiple embedded interpreters & one time initialization

From:
Milosz Tanski
Date:
July 16, 2008 08:14
Subject:
XS, multiple embedded interpreters & one time initialization
Message ID:
C0A5E31718FC064A91E9FD7BE2F081B1017CC98B@exchange.gridapp.com
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.
 
Thanks,
-- Milosz



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About