1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00
freebsd/lib/libkse
David Xu 639b4ccf7d Original pthread_once code has memory leak if pthread_once_t is used in
a shared library or any other dyanmic allocated data block, once
pthread_once_t is initialized, a mutex is allocated, if we unload the
shared library or free those data block, then there is no way to deallocate
the mutex, result is memory leak.
To fix this problem, we don't use mutex field in pthread_once_t, instead,
we use its state field and an internal mutex and conditional variable in
libkse to do any synchronization, we introduce a third state IN_PROGRESS to
wait if another thread is already in invoking init_routine().
Also while I am here, make pthread_once() conformed to pthread cancellation
point specification.

Reviewed by: deischen
2003-09-09 22:38:12 +00:00
..
arch Don't assume sizeof(long) = sizeof(int) on x86; use int 2003-09-03 17:56:26 +00:00
support The caller is expected to set up PIC register corectly before 2003-09-05 18:08:19 +00:00
sys Don't assume sizeof(long) = sizeof(int) on x86; use int 2003-09-03 17:56:26 +00:00
test Don't run verify directly as that would require the perl script to 2003-08-13 03:59:18 +00:00
thread Original pthread_once code has memory leak if pthread_once_t is used in 2003-09-09 22:38:12 +00:00
Makefile Rethink the way thr_libc.So is generated. Relying on GCC to extract 2003-09-02 19:37:11 +00:00