At 05:24 PM 3/10/00 -0500, Charles Lane wrote:
>Dan, I *think* the only place changes are needed to accomodate threading
>are where we have "one time initialization" stuff:
>
>         static int initted = 0;
>         if (!initted) {
>             initted = 1;
>             ....blah blah blah...
>         }
>
>(actually unlikely to cause a problem, but I feel better when there's NO
>possibility of a race condition).  Can you point me to relevant code for
>handling this?

It wouldn't be the only race condition. prime_env_iter's threadsafing bit's 
actually outright broken...

>Something like:
>         static int initted = 0;
>         if (!initted) {
>             _global_lock_this_bit();
>             if (!initted) {
>                 initted = 1;
>                 ....blah blah blah...
>             }
>             _global_unlock_this_bit();
>         }
>I can find suitable pthreads calls, but threads in Perl has it's own
>peculiar idiom....

pthread_once is your friend here. Go ahead and use it and things'll be OK.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to