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

Re: [rtl] Figuring out the state of a thread



On Tue, Dec 11, 2001 at 02:27:25PM -0500, Pablo Alvarez wrote:
> Hi all,
> 
> For my implementation, I need to create new threads, let them run for a 
> little while and die, and then keep creating new ones. Given that I cannot
> dynamically allocate memory within the RT context, I was thinking about 
> having an array of pthread_ts, and cycling through it picking the first 
> inactive thread when I needed a new one to create. But I cannot figure out 
> how to find out, knowing only the thread handle, whether a thread is still 
> alive (in which case I would want to leave it alone). Any suggestions?

How about some shared memory, where each thread has a status byte it
can us; writes some sort of "I'm free to do some work" to it...

You wouldn't need to worry about locking or anything...

Gary (-;