diff options
author | jasone <jasone@FreeBSD.org> | 2001-05-20 23:08:33 +0000 |
---|---|---|
committer | jasone <jasone@FreeBSD.org> | 2001-05-20 23:08:33 +0000 |
commit | adf603d4b170a8622047e0fd342070ac6f07caf4 (patch) | |
tree | c37f9e05a6d81f226bfef98090c73e613802b9c7 /lib/libpthread/thread/thr_suspend_np.c | |
parent | cdb5d97b478a3e4f97dd6c0cd43105d0951daed5 (diff) | |
download | FreeBSD-src-adf603d4b170a8622047e0fd342070ac6f07caf4.zip FreeBSD-src-adf603d4b170a8622047e0fd342070ac6f07caf4.tar.gz |
Instead of using a join queue for each thread, use a single pointer to
keep track of a joiner. POSIX only supports a single joiner, so this
simplification is acceptable.
At the same time, make sure to mark a joined thread as detached so that
its resources can be freed.
Reviewed by: deischen
PR: 24345
Diffstat (limited to 'lib/libpthread/thread/thr_suspend_np.c')
-rw-r--r-- | lib/libpthread/thread/thr_suspend_np.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_suspend_np.c b/lib/libpthread/thread/thr_suspend_np.c index 81ee328..0e272ff 100644 --- a/lib/libpthread/thread/thr_suspend_np.c +++ b/lib/libpthread/thread/thr_suspend_np.c @@ -105,10 +105,15 @@ _pthread_suspend_np(pthread_t thread) PTHREAD_SET_STATE(thread, PS_SUSPENDED); break; + case PS_JOIN: + /* Mark the thread as suspended and joining: */ + thread->suspended = SUSP_JOIN; + + PTHREAD_NEW_STATE(thread, PS_SUSPENDED); + break; case PS_FDLR_WAIT: case PS_FDLW_WAIT: case PS_FILE_WAIT: - case PS_JOIN: /* Mark the thread as suspended: */ thread->suspended = SUSP_YES; |