Basically I want to simulate two threads to operate on the same object. Suppose these two threads will have "task 1" and "task 2" operations on this single object. How can I "control" these two threads so that they operate on this object in the following sequence --
1.
thread 2 performs task 1; after it is done --
2. while thread 1 performs task 1; thread 2 performs task 2; after that --
3. thread 1 performs task 2;
How can I do that ? Can someone show me some snippet ?
thanks.