Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can POSIX join on any thread?

join POSIX thread
0
Posted

How can POSIX join on any thread?

0

The pthread_join() function will not allow you to wait for “any” thread, like the UI function thr_join() will. How can I get this? A: > >: I want to create a number of threads and then wait for the first > >: one to finish, not knowing which thread will finish first. But > >: it appears pthread_join() forces me to specify exactly which of > >: my threads I want to wait for. Am I missing something basic, or > >: is this a fundamental flaw in pthread_join()? > > > >: Rich Stevens > > > >Good call. I notice Solaris native threads have this support and the > >pthreads implementations I’ve seen don’t. I wondered about this myself. > > > > Same here. The situation I ran into was a case where once the main > created the necessary threads and completed any work it was responsible > for, it just needed to “hang-around” until all the threads completed > their work before exiting. pthread_join() for “any” thread in loop using > a counter for the number of threads seemed the logical choice. Then I

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123