thread: simplify 'free' process
authorRyan Lortie <desrt@desrt.ca>
Thu, 13 Oct 2011 04:18:17 +0000 (00:18 -0400)
committerRyan Lortie <desrt@desrt.ca>
Thu, 13 Oct 2011 04:18:17 +0000 (00:18 -0400)
commit62be9365d9641073185c28c8f0a8fe06fb9a92e0
treed41d924602f1f42b9975807847b5effc8ae19d5e
parentbecb4b820f84badac9eaee4e123c8a0ef41a9ba3
thread: simplify 'free' process

GThread is freed using some very slightly confusing logic: if the thread
was created 'joinable', then the structure is freed after the join()
call succeeds (since we know the thread has exited).  If the thread was
not created 'joinable' then the free is when the thread quits (since we
know 'join' will not be called later).

Move to a straight ref-counting system: 1 ref owned by the thread and 1
extra ref if the thread is joinable.  Both thread quit and joining will
decrease the refcount by 1.
glib/gthread.c
glib/gthreadprivate.h