Multiple threads block on a single object - howto?

eyalasko1 wrote on Wednesday, May 09, 2018:

Hi,

How do I deal with a scenario in which several threads can run only after another thread already run (something similiar ManualResetyEvent in .NET).

I need to run some threads initialization code (the part before the while(true)) only after a ‘service thread’ completed its initialization.

Counting sempahore is not good as I don’t know the number of blocked threads …

Thanks

rtel wrote on Wednesday, May 09, 2018:

If this is part of your initialisation then the easiest way would be to
not create the other threads until after the event they want to wait for
has completed. Alternatively you could use an event group - but that
could be overkill.

eyalasko1 wrote on Wednesday, May 09, 2018:

Hi Richard,
I’ll create the other threads as part of the service thread’s initialization as you suggested.

Thanks !!