From: Martin Mares Date: Mon, 18 Dec 2006 10:52:33 +0000 (+0100) Subject: Free thread context structure on thread termination. X-Git-Tag: holmes-import~506^2~13^2~190 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=66f968af299fe8ce6ba65b38fd3cb477e9112818;p=libucw.git Free thread context structure on thread termination. --- diff --git a/lib/threads.c b/lib/threads.c index 26033e54..f45c8e38 100644 --- a/lib/threads.c +++ b/lib/threads.c @@ -17,10 +17,16 @@ static pthread_key_t ucwlib_context_key; static pthread_mutex_t ucwlib_master_mutex; +static void +ucwlib_free_thread_context(void *p) +{ + xfree(p); +} + static void CONSTRUCTOR ucwlib_threads_init(void) { - if (pthread_key_create(&ucwlib_context_key, NULL) < 0) + if (pthread_key_create(&ucwlib_context_key, ucwlib_free_thread_context) < 0) die("Cannot create pthread_key: %m"); pthread_mutex_init(&ucwlib_master_mutex, NULL); }