I think that pthread_join() might be easier for you. You just pass the thread ID of the thread you want to wait for to finish. (And can even get it's return value).
Jason > -----Original Message----- > From: Dale Kingston [mailto:[EMAIL PROTECTED] > Sent: Monday, September 01, 2003 2:31 AM > To: [email protected] > Subject: Threading question > > > Ok I have a small question with threading. I plan to thread > my muds boot up. Making it so it will load given blocks at a > time. You know like one thread load all the main system > things like areas with the room's mobs and objects. Probably > put like skills in that as well. And then have the others > load some of the minor things I have loading. > > > > My question is obviously I'll need to add something that > prevents the main thread from continuing with out the other > threads finishing first. I guess my question is with semaphores. > > > > I figured with the main thread before it leaves the boot_db I > would add a sem_wait for each thread that was spawned. And > just have each thread post that it's finished before it > terminates. My only question is with this, lets say I have a > wait for say thread_1 and thread_2. So I put the waits in this > order: > > > > sem_wait(&thread_1); > > sem_wait(&thread_2); > > > > Ok now lets say thread two finishes before thread 1. When > thread 1 finishes and posts, will it allow it past the wait > for thread 2 if thread 2 posted before it hit the wait? Or > would it wait for a post while its sitting in the wait? > > > > Or is there maybe a better way I could accomplish this > syncing with the threads to wait on finishing the boot until > all the threads are completed? > > > -- > ROM mailing list > [email protected] > http://www.rom.org/cgi-bin/mailman/listinfo/rom >

