[omniORB] Omnithread bug

Theo Aukerman taukerman@logici.com
Mon, 26 Jul 1999 08:36:09 -0700


I'm using the omniORB 2.7.1 distribution on NT, and would like to thank you
for producing a such fine CORBA implementation.

I do think I have found a bug in the omnithread library, however.

I found that when I wanted to use omni_condition::timedwait() to wait for a
time 500 miliseconds in the future (abs time = current time + 500ms), I
would (about half the time) get a longer wait (on the order of a few
seconds).

The following code in omni_condition::timedwait appears to have caused the
problem.
___________________nt.cc line 231___________________
    DWORD timeout = (abs_sec-now_sec) * 1000 + (abs_nsec-now_nsec) /
1000000;

    if ((abs_sec <= now_sec) && ((abs_sec < now_sec) || (abs_nsec <
abs_nsec)))
	timeout = 0;

__________________end nt.cc line 231________________


In my circumstance, about half the time, abs_sec - now_sec == 1.  When that
happens, now_nsec is greater than abs_nsec, forcing a wrap of the 32 bit
value resulting in about 4 seconds being added to the timeout value.

Also, is it safe to set the timeout to 0 if the time has elapsed?  While I
have been debugging, I have needed to put a breakpoint at the
WaitForSingleObject() call, and manually change the timeout to keep the wait
from waiting forever.

Thanks in advance,

Theo Aukerman
Taukerman@logici.com
(619)-455-7299x122

P.S. I've posted this to the mailing list because when I searched, I found
other people asking about timedwait().  Perhaps this will help them as well.