Re: too many threads



In message <Pine GSO 4 10 10104102059330 24915-100000 juno>you write:
>I'm making a small two button application to understand threads. Both are
>radiobuttons. One button starts a thread (in the handler) and the second
>button stops it. When I first start the application ps shows one process.
>When I push "start", ps shows THREE threads. Finally, when I push "stop",
>the spawned thread does stop, but ps shows 2 threads. Can someone shed
>some light on this? Where does the extra thread come from?

the Linux implementation of pthreads included in libc includes a
"manager thread" that handles POSIX semantics of POSIX signals, thread
control, etc. hence, for any N-threaded program, ps(1) will always
show N+1 threads.

there are some alternative pthreads implementations that don't do
this; i have never tried any of them.

--p




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]