From: Nat Pryce Date: 2002-09-18T01:40:07+09:00 Subject: Re: ConditionVariables As far as I can see, you can't implement this logic if all your threads are identical. That is because one thread will deadlock the others by holding on to resource 0 while waiting for resource 1. The other threads will be waiting for resource 0 and so be unable to signal resource 1 and thereby wake the thread holding resource 0. You can solve the problem by waiting for the resources in the other order. E.g. only acquire resource0 when resource1 is available. Cheers, Nat. On Fri, 2002-09-13 at 18:01, ara howard wrote: > i'm trying to grasp ConditionVariable usage, i understand how it is > supposed to work, what i do not understand is how one would implement > the following logic: > > (set of idendical threads needing resource0 AND resource1) > > in each thread > synchronize on resource0 > wait for resource1 > use resources0/1 > signal resource 1 > > of course such logic using mutex and conditionvarible does not work, > how does one wait on a second resource in such a way that the wait can > be ended WITHOUT signal being called - eg. the FIRST wait should work, > after that every thread will signal being done - a second mutex > perhaps? > > -ara -- Dr. Nathaniel Pryce, Technical Director, B13media Ltd. Studio 3a, 22-24 Highbury Grove, London N5 2EA, UK http://www.b13media.com