[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] libports: fix the thread counts in case the thread creation
From: |
Samuel Thibault |
Subject: |
Re: [PATCH] libports: fix the thread counts in case the thread creation fails |
Date: |
Sat, 9 Nov 2013 18:21:51 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Justus Winter, le Sat 09 Nov 2013 14:21:09 +0100, a écrit :
> Previously the number of total threads and the number of unused
> threads was wrong if at one point the creation of a thread failed. Fix
> this by decrementing both counters that were previously optimistically
> incremented. Adjust the comment accordingly.
Ack.
> * libports/manage-multithread.c (ports_manage_port_operations_multithread):
> Fix the thread counts in case the thread creation fails.
> ---
> libports/manage-multithread.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c
> index 4003cfb..c73305d 100644
> --- a/libports/manage-multithread.c
> +++ b/libports/manage-multithread.c
> @@ -140,9 +140,13 @@ ports_manage_port_operations_multithread (struct
> port_bucket *bucket,
> pthread_detach (pthread_id);
> else
> {
> - /* XXX The number of threads should be adjusted but the code
> - and design of the Hurd servers just don't handle thread
> - creation failure. */
> + pthread_spin_lock (&lock);
> + totalthreads--;
> + nreqthreads--;
> + pthread_spin_unlock (&lock);
> + /* There is not much we can do at this point. The code
> + and design of the Hurd servers just don't handle
> + thread creation failure. */
> errno = err;
> perror ("pthread_create");
> }
> --
> 1.7.10.4
>
>
--
Samuel
<s> bah, j'aime bien les feux d'artifices, mais j'ai peur de me prendre un
boeing sur le coin de la gueule si je vais sur le pont de brooklyn
-+- #ens-mim - 11 septembre forever -+-
- [PATCH] libports: fix the thread counts in case the thread creation fails, Justus Winter, 2013/11/09
- Re: [PATCH] libports: fix the thread counts in case the thread creation fails,
Samuel Thibault <=
- Re: [PATCH] libports: fix the thread counts in case the thread creation fails, Neal H. Walfield, 2013/11/10
- Re: [PATCH] libports: fix the thread counts in case the thread creation fails, Samuel Thibault, 2013/11/10
- Re: [PATCH] libports: fix the thread counts in case the thread creation fails, Neal H. Walfield, 2013/11/10
- lockless thread management in libports (was: [PATCH] libports: fix the thread counts in case the thread creation fails), Justus Winter, 2013/11/11
- [PATCH] libports: implement lockless management of threads, Justus Winter, 2013/11/11
- Re: [PATCH] libports: implement lockless management of threads, Neal H. Walfield, 2013/11/11
- Re: [PATCH] libports: implement lockless management of threads, Justus Winter, 2013/11/12
- Re: [PATCH] libports: implement lockless management of threads, Samuel Thibault, 2013/11/12
- Re: [PATCH] libports: implement lockless management of threads, Emilio Pozuelo Monfort, 2013/11/13
- Re: [PATCH] libports: implement lockless management of threads, Justus Winter, 2013/11/15