[vlc-devel] [PATCH 6/6] os2: thread: support static condition variable
KO Myung-Hun
komh78 at gmail.com
Fri Jun 12 03:32:59 CEST 2015
Rémi Denis-Courmont wrote:
> Le 2015-06-11 13:58, KO Myung-Hun a écrit :
>>>> +static vlc_static_cond_t *static_condvar_start = NULL;
>>>> +
>>>> +static void vlc_static_cond_init (vlc_cond_t *p_condvar)
>>>> +{
>>>> + vlc_mutex_lock (&super_mutex);
>>>> +
>>>> + if (p_condvar->hev == NULLHANDLE)
>>>> + {
>>>> + vlc_cond_init_common (p_condvar, p_condvar->clock);
>>>> +
>>>> + vlc_static_cond_t *new_static_condvar;
>>>> +
>>>> + new_static_condvar = malloc (sizeof (*new_static_condvar));
>>>> + if (unlikely (!new_static_condvar))
>>>> + abort();
>>>> +
>>>> + memcpy (&new_static_condvar->condvar, p_condvar, sizeof
>>>> (*p_condvar));
>>>> + new_static_condvar->next = static_condvar_start;
>>>> + static_condvar_start = new_static_condvar;
>>>
>>> Won´t this leave stale pointers after dlclose() and crash in
>>> vlc_static_cond_destroy_all()?
>>
>> On OS/2, termination codes of _DLL_InitTerm() is called when calling
>> dlclose(). So if you call dlclose(), vlc_static_cond_destroy_all() will
>> be executed before DLL is unloaded.
>
> Libvlccore, maybe. I don't see how vlc_static_cond_destroy_all() gets
> invoked when closing a VLC module.
>
When closing VLC module, vlc_static_cond_destroy_all() is not called. It
is called only when libvlccore is unloaded.
And vlc_static_cond_init() copy the content of a static cond not an
address. So even if VLC module is closed, vlc_static_cond_destroy_all()
does not have garbage pointers at all.
--
KO Myung-Hun
Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM
Korean OS/2 User Community : http://www.ecomstation.co.kr
More information about the vlc-devel
mailing list