GLIB 2.36.0 gthread-posix pthread detached & PTHREAD_CREATE_DETACHED issue

Hi team,
I am working on the GLIB latest version 2.36.0,the OS is Ubuntu 12.10, i reviewed the source code of the GThread part.
i found two issue about the pthread detached:
1.if g_thread_join a GThread, the GThread's system pthread can't be detached, it will occur the Memory leak.
2.when no joined, how to terminate a GThread, call the g_thread_unref , but the ref_count is 2, we call the g_thread_unref two time?
pls see pthread.h
/* Initialize thread attribute *ATTR with default attributes
scheduling policy is SCHED_OTHER,
no user-provided stack). */
extern int pthread_attr_init (pthread_attr_t *__attr);
/* Indicate that the thread TH is never to be joined with PTHREAD_JOIN.
The resources of TH will therefore be freed immediately when it
terminates, instead of waiting for another thread to perform PTHREAD_JOIN
on it. */
extern int pthread_detach (pthread_t __th);

Victor jiang

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]