Hi:

I’ve got a situation whereby, I’ve got a number of boost::thread objects being created by classes in my program and run for the duration of the program. What I need to do is when the exit menu item is activated, close down all threads.

I was going to use a condition, and have the threads continue until the condition is signalled, and then use notify_all when the exit menu item is activated.

Given that I want this condition to be multi-read/exclusive write, what mutex is the best option?

Also will I need to use a mutex in the threads I need to terminate.

I see the code of the threads being something like:

While (Terminate !=false)

{

//perform actions.

};

Normally in this situation I’d use a windows event and the WaitForSingle/multipleObject functions, but as this has to be cross platform I carn’t do this.

Any help with this appreciated.

Cheers

Sean.