[omniORB] omnithread problem

Sai-Lai Lo S.Lo@uk.research.att.com
12 Aug 1999 10:43:38 +0100


You have to grab the mutex before calling timedwait(). Please refer to
omnithread.h or any text describing conditional variable usage for details.

Pelase also check out my earlier posting on the same subject:

http://www.uk.research.att.com/omniORB/archives/1999-01/0063.html

Sai-Lai

>>>>> Kelly Burkhart writes:

>     virtual void run( void * ) {
>         cout << "running!\n";
>         unsigned long as1, ans1;

----->          omni_mutex_lock sync(*mux_);
Add this.          

>         get_time( &as1, &ans1, 1, 0 );
cond_-> timedwait( as1, ans1 );
>         return;
>     }

>     // Don't use these!
>     SubThread( const SubThread & );
>     SubThread &operator=( const SubThread & );
> };

> int
> main()
> {
>     SubThread *smt = new SubThread();
>     sleep(2);
>     return 0;
> }




-- 
Sai-Lai Lo                                   S.Lo@uk.research.att.com
AT&T Laboratories Cambridge           WWW:   http://www.uk.research.att.com 
24a Trumpington Street                Tel:   +44 1223 343000
Cambridge CB2 1QA                     Fax:   +44 1223 313542
ENGLAND