[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix thread-unsafe lazy initializations
From: |
Mark H Weaver |
Subject: |
Re: [PATCH] Fix thread-unsafe lazy initializations |
Date: |
Tue, 05 Mar 2013 13:53:00 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Hi Ludovic,
address@hidden (Ludovic Courtès) writes:
> Mark H Weaver <address@hidden> skribis:
>
>> --- a/doc/ref/api-modules.texi
>> +++ b/doc/ref/api-modules.texi
>> @@ -942,14 +942,15 @@ the @var{name} is not bound in the module, signals an
>> error. Returns a
>> variable, always.
>>
>> @example
>> -SCM my_eval_string (SCM str)
>> address@hidden
>> - static SCM eval_string_var = SCM_BOOL_F;
>> +static SCM eval_string_var;
>>
>> - if (scm_is_false (eval_string_var))
>> - eval_string_var =
>> - scm_c_public_lookup ("ice-9 eval-string", "eval-string");
>> +void my_init (void)
>> address@hidden
>> + eval_string_var = scm_c_public_lookup ("ice-9 eval-string",
>> "eval-string");
>> address@hidden
>>
>> +SCM my_eval_string (SCM str)
>> address@hidden
>> return scm_call_1 (scm_variable_ref (eval_string_var), str);
>> @}
>> @end example
>
> The doc should say something about ‘my_init’, and perhaps mention
> locking?
Can you suggest some text? 'my_init' seems obvious to me, and given
that this is just an example for 'scm_c_*_lookup', it seems out of place
to talk about general locking issues here, but feel free to propose some
text to go here.
Thanks,
Mark