perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: Question : threads and locking?
Date Tue, 04 Dec 2001 13:10:27 GMT
Philippe M. Chiasson wrote:

> Looking thru the todo/api.txt file, I noticed a few items that
> are stuck in read-only mode, because thread locking is needed if
> changing them.
> 
> I already have something in the works, but my question is that under
> a non-threaded model, like prefork, all that is uesless, right? So,
> what's the nice way for me to go on and write thread mutex stuff
> that will only happen when running under threads ? 
> 
> My knoledge of the configure/build system is quite limited....


If you are running under threaded mpm, you can safely assume that Perl 
is threaded (won't pass the build otherwise). So no conditioning 
required fromt the Perl side.

Since the preforked mpm can actually be compiled with threaded apr, I think that's 

the only ifdef() required is:


#if APR_HAS_THREADS
     /* code here */
#endif

If the functionality is very different between forked and non-forked 
implementation, to avoid code cluttering with ifdefs, we probably should 
use two versions of the functions like foo_thr() and foo_nthr() and 
alias to foo() at compile time.

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message