[vlc-devel] [PATCH] MediaCodec: simplify jni thread attach/detach
Rémi Denis-Courmont
remi at remlab.net
Sat Mar 29 07:45:40 CET 2014
Le vendredi 28 mars 2014, 11:15:11 bbcallen a écrit :
> +static pthread_key_t g_thread_key;
> +static pthread_once_t g_key_once = PTHREAD_ONCE_INIT;
> +
> +static void vlcjni_thread_destroy(void* value)
> +{
> + if (value != NULL) {
Tautology?
> + (*myVm)->DetachCurrentThread(myVm);
> + pthread_setspecific(g_thread_key, NULL);
> + }
> +}
> +
> +static void vlcjni_make_thread_key(void)
> +{
> + pthread_key_create(&g_thread_key, vlcjni_thread_destroy);
> +}
If the shared object is loaded then unloaded dynamically, this will leak, and
possibly crash.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list