diff options
author | neal <neal> | 2004-11-30 10:57:52 +0000 |
---|---|---|
committer | neal <neal> | 2004-11-30 10:57:52 +0000 |
commit | 32c217fc41bf0dcaade8c18a59664c828f5ab6b5 (patch) | |
tree | 37856c1136c984ccb83354b00124aee98c1cdc58 | |
parent | 8b8f6aead2a3a85221e048a01bdc4f3815de209a (diff) |
libhurd-cap-server/
2004-11-30 Neal H. Walfield <neal@gnu.org>
* bucket-manage-mt.c (manage_mt_get_next_worker): If
pthread_create_from_l4_tid_np fails, return WORKER to pthread's
available thread pool.
(worker_alloc_async): Likewise.
(hurd_cap_bucket_manage_mt): Likewise.
-rw-r--r-- | libhurd-cap-server/ChangeLog | 8 | ||||
-rw-r--r-- | libhurd-cap-server/bucket-manage-mt.c | 31 |
2 files changed, 31 insertions, 8 deletions
diff --git a/libhurd-cap-server/ChangeLog b/libhurd-cap-server/ChangeLog index 2d4ea3a..041ffb1 100644 --- a/libhurd-cap-server/ChangeLog +++ b/libhurd-cap-server/ChangeLog @@ -1,5 +1,13 @@ 2004-11-30 Neal H. Walfield <neal@gnu.org> + * bucket-manage-mt.c (manage_mt_get_next_worker): If + pthread_create_from_l4_tid_np fails, return WORKER to pthread's + available thread pool. + (worker_alloc_async): Likewise. + (hurd_cap_bucket_manage_mt): Likewise. + +2004-11-30 Neal H. Walfield <neal@gnu.org> + * bucket-manage-mt.c: Include <compiler.h>. (manage_mt_worker): Use EXPECT_TRUE and EXPECT_FALSE rather than __builtin_expect. Comment fixes. diff --git a/libhurd-cap-server/bucket-manage-mt.c b/libhurd-cap-server/bucket-manage-mt.c index de43c7b..561d963 100644 --- a/libhurd-cap-server/bucket-manage-mt.c +++ b/libhurd-cap-server/bucket-manage-mt.c @@ -743,9 +743,14 @@ manage_mt_get_next_worker (struct worker_info *info, pthread_t *worker_thread) if (worker == l4_nilthread) err = EAGAIN; else - err = pthread_create_from_l4_tid_np (worker_thread, NULL, - worker, manage_mt_worker_sync, - info); + { + err = pthread_create_from_l4_tid_np (worker_thread, NULL, + worker, manage_mt_worker_sync, + info); + /* Return the thread to the pool. */ + if (err) + pthread_pool_add_np (worker); + } if (!err) { @@ -833,10 +838,16 @@ worker_alloc_async (void *arg) if (worker == l4_nilthread) err = EAGAIN; else - err = pthread_create_from_l4_tid_np (&worker_thread, NULL, - worker, - manage_mt_worker_async, - info); + { + err = pthread_create_from_l4_tid_np (&worker_thread, NULL, + worker, + manage_mt_worker_async, + info); + /* Return the thread to the pool. */ + if (err) + pthread_pool_add_np (worker); + } + if (!err) { pthread_detach (worker_thread); @@ -916,7 +927,11 @@ hurd_cap_bucket_manage_mt (hurd_cap_bucket_t bucket, err = pthread_create_from_l4_tid_np (&worker_thread, NULL, worker, manage_mt_worker_sync, &info); if (err) - return err; + { + /* Return the thread to the pool. */ + pthread_pool_add_np (worker); + return err; + } pthread_detach (worker_thread); pthread_mutex_lock (&bucket->lock); |