[asterisk-dev] pthread_getspecific() in app_voicemail

Russell Bryant russell at digium.com
Thu Apr 16 10:38:25 CDT 2009


Mark Sirota wrote:
> --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.

Excellent!

It would be best if you submit the patches separately since they are for
different issues.

Thanks,

-- 
Russell Bryant
Digium, Inc. | Senior Software Engineer, Open Source Team Lead
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list