Closed Bug 36818 Opened 24 years ago Closed 24 years ago

PR_WaitCondVar(..., PR_INTERVAL_NO_TIMEOUT) broken on beos

Categories

(NSPR :: NSPR, defect, P3)

x86
BeOS

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: justin, Assigned: wtc)

Details

Attachments

(1 file)

the beos version of PR_WaitCondVar() includes an (incorrect) workaround for a
bug in a previous version of the beos.  this workaround increments the value of
the 'timeout' argument before it is evaluated.  because PR_INTERVAL_NO_TIMEOUT
is currently defined as -1, and PR_INTERVAL_NO_WAIT is currently defined as 0,
this effectively turns all forever-blocking cvar waits into non-waits, and
PR_WaitCondVar() returns (success) immediately.  this causes threads in
nsThreadPools to busy wait for tasks, etc....

in fixing the above, i also discovered that, due to a bug in the latest version
of the beos, PR_Interrupt() no longer interrupted a thread blocked on a cvar
wait (see patch for details).
Attached patch fix for bugSplinter Review
Keywords: patch
Matt, Duncan: could you review Justin's patch, especially
the patch for btthread.c:PR_Interrupt?  Thanks.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Target Milestone: --- → 4.0.1
Version: 4.0.1 → 4.0
I reviewed justin's patch.  I modified the patch to
follow the existing style of the files.

I checked in the patch on the main trunk.
/cvsroot/mozilla/nsprpub/pr/src/bthreads/btcvar.c, revision 3.4
/cvsroot/mozilla/nsprpub/pr/src/bthreads/btthread.c, revision 3.4

Note that SeaMonkey is pulling the NSPRPUB_CLIENT_BRANCH
of mozilla/nsprpub.  I will check in the patch on the
NSPRPUB_CLIENT_BRANCH when the mozilla tree re-opens.
Checked in the patch on the NSPRPUB_RELEASE_4_0_BRANCH.
/cvsroot/mozilla/nsprpub/pr/src/bthreads/btcvar.c, revision 3.3.58.1
/cvsroot/mozilla/nsprpub/pr/src/bthreads/btthread.c, revision 3.3.58.1

Justin, you might want to run the following NSPR tests to
make sure the changes are correct.
% cvs co mozilla/nsprpub # check out the tip
% cd mozilla/nsprpub
% gmake export # this does a debug build
% cd pr/tests
% gmake export # this builds the tests
% cd BeOS5.0_DBG.OBJ
% ./cvar -d  # a test of condition variables
% ./cvar2    # another test of condition variables
% ./perf     # condition variables, semaphores, etc.
% ./intrupt -d # a test of PR_Interrupt
Checked in the fix on the NSPRPUB_CLIENT_BRANCH.
/cvsroot/mozilla/nsprpub/pr/src/bthreads/btcvar.c, revision 3.3.72.1
/cvsroot/mozilla/nsprpub/pr/src/bthreads/btthread.c, revision 3.3.72.1
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
i ran the tests, and in doing so, discovered some further problems with the
current beos condition variable implementation.

however, this patch did indeed fix infinite waits on condition vars, so i'm
verifying it as fixed...

thanks!
Status: RESOLVED → VERIFIED
Target Milestone: 4.0.1 → 4.0.2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: