Re: PR_WaitCondVar
Wan-Teh Chang <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.nspr |
|---|---|
| Message-ID | <[email protected]> |
Wan-Teh Chang wrote: > Sabyasachi Ruj wrote: >> Hello, >> How can I determine that 'PR_WaitCondVar' returned because of timeout or >> because it has received the notification? >> In both cases that function returns PR_SUCCESS. >> >> I've gone through the documentation but do not understand what it meant. > > It is a design decision that PR_WaitCondVar does not report a timeout. > If you care about timeout, you must call PR_IntervalNow() before and > after the PR_WaitCondVar call and see if the elapsed time is greater > than the timeout. > > The rationale for the design decision is that it is hard for the > implementation to report a timeout accurately. I added a sentence at the end of the PR_WaitCondVar page to clarify this, with a link to the PR_IntervalNow page: http://developer.mozilla.org/en/docs/PR_WaitCondVar#Description You can find sample code on the PR_IntervalNow page. Let me know if the man page or the sample code is still not clear. Wan-Teh