From: Arlen Cuss Date: 2012-11-26T20:13:05+09:00 Subject: Re: atomic statements in multithreading That is not what "atomic" would usually mean; what you're asking for is a mix of many other concepts. Thread.exclusive may be want you want: step-1 Thread.exclusive do step-2 step-3 end step-4 step-5 But it's loaded with gotchas and you may want to be more explicit; or indeed, work out a way to not need this synchronisation between threads. On Monday, 26 November 2012 at 10:03 PM, ajay paswan wrote: > suppose I am working in multiple thread each thread runs following > steps: > > > > step-1 > step-2 > step-3 > step-4 > step-5 > > now I want to make step 2 and step 3 an atomic statement, it means when > one thread goes to statement 2, every other thread should stop and run > only when that particular thread completes step 3. Is it possible? How? > > note mutex is not the solution, as mutex keeps thread not running a > block of code at same time, here if one thread goes to the block all > other thread should stop. > > -- > Posted via http://www.ruby-forum.com/.