Overview
Features
Download
Documentation
Community
Add-Ons & Services

thread wait and notify??

Please post support and help requests here.

thread wait and notify??

Postby yakovyarmo » 20 Feb 2009, 01:43

can any one give me an example on how to use this mechanism??
yakovyarmo
 
Posts: 1
Joined: 20 Feb 2009, 01:41

Re: thread wait and notify??

Postby alex » 20 Feb 2009, 01:57

Like this:
Code: Select all
class MyRunnable: public Runnable
{
 public:
  void run() { _event.wait(); }
  void notify() { _event.set(); }
private:
  Event _event;
};

int main()
{
  Thread thread;
  MyRunnable r;
  thread.start(r);
  Thread::sleep(200);
  r.notify();
  thread.join();
  return 0;
}
alex
 
Posts: 1044
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron