How can POSIX join on any thread?
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