Subj : Re: How to wait on multiple condition variables or implement a similar semantics To : comp.programming.threads From : David Schwartz Date : Wed Mar 16 2005 08:16 am "vikky@gmail.com" wrote in message news:1110980496.126651.296950@g14g2000cwa.googlegroups.com... > Thanks for the answer Joe but there is one problem. You suggested that > i could use multiple conditions and use their ANDing/ORing. However how > do you suggest to represent the condition pertaining to closing of the > application? With a variable, 'shutdown', and a shutdown mutex. When you want to shut the application down, lock the shutdown mutex, set 'shutdown' to 'true', unlock the shutdown mutex, and broadcast the condition variable. Have threads periodically lock the shutdown mutex, check the 'shutdown' variable, and if it's 'true', terminate cleanly. DS .