[asterisk-dev] pthread_getspecific() in app_voicemail

Mark Sirota msirota at isc.upenn.edu
Thu Apr 16 10:33:37 CDT 2009


--On 2009-04-16 10:15 AM -0400 I wrote:
> --On 2009-04-16 8:48 AM -0500 Russell Bryant <russell at digium.com> wrote:
>> From a _very_ quick look at the code, if it is possible for
>> pthread_getspecific() to be called before pthread_setspecific() in this
>> case, that probably also means that the key has not yet been initialized.
>>
>>    pthread_once(&ts_vmstate.once, ts_vmstate.key_init);
>>
>> This code _must_ run before either get/set.  Try adding it before the
>> case where get may be called before set.  It's harmless, as the
>> definition of how pthread_once() works ensures that it will only happen
>> one time.
>
> Thanks Russell, I think you've hit it on the head -- I'll try that today.

Bingo, that fixes it.  We'll submit it as a patch alongside a larger one 
addressing message counts for externnotify.

Mark




More information about the asterisk-dev mailing list