>
> One solution is to have the threads exit (via the pthread_join
> mechanism, of course) when they have finished the current
> request.
>
The way i understand the description of pthread_join, the
thread which called pthread_create must call pthread_join.
So that would mean that a thread who finished its job
should somehow notify the main thread to go ahead with the join?
Since my main thread is usually in a blocked state (accept()),
a finishing thread should probably "sign in" into some (locked) variable
which the main thread could inspect next time he wakes up.
Would this be a correct way?

>
> Another (very common) solution is not to create one thread per request,
> but instead have a small set of worker threads, each one to handle
> many requests over the life of the program.  A "master" thread
> accepts requests, and gives each one to one of the worker threads.
> Only if there are no available worker threads does it create new
> threads.
>
Here again, this would probably have to be done by some sign-in/sign-out
mechanism...

Thanks for the suggestions
  Jody

> J
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to