Closed Bug 43507 Opened 25 years ago Closed 25 years ago

PR_EnableClockInterrupts calls _PR_InitStuff.

Categories

(NSPR :: NSPR, defect, P3)

x86
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

PR_EnableClockInterrupts and PR_DisableClockInterrupts call _PR_InitStuff to implicitly initialize NSPR. This is wrong. The right function to call is _PR_ImplicitInitialization. _PR_ImplicitInitialization is defined as follows: void _PR_ImplicitInitialization() { _PR_InitStuff(); /* Enable interrupts */ #if !defined(_PR_PTHREADS) && !defined(_PR_GLOBAL_THREADS_ONLY) _PR_MD_START_INTERRUPTS(); #endif } The difference from _PR_InitStuff is that _PR_ImplicitInitialization also calls _PR_MD_START_INTERRUPTS. On Unix, _PR_MD_START_INTERRUPTS installs the signal handler for SIGALRM. If PR_EnableClockInterrupts is the first NSPR function to be called, NSPR will be incorrectly initialized -- the SIGALRM signal handler is not installed. A workaround is to ensure that PR_EnableClockInterrupts is not the first NSPR function to be called.
Status: NEW → ASSIGNED
Target Milestone: --- → 4.1
I came up with a different way to fix this bug. Instead of changing PR_EnableClockInterrupts and PR_DisableClockInterrupts to call _PR_ImplicitInitialization, I moved the code that installs the SIGALRM signal handler from _MD_StartInterrupts to _MD_EnableClockInterrupts. This way we can be sure that the SIGALRM handler is installed before we start the interval timer. /cvsroot/mozilla/nsprpub/pr/include/md/_unixos.h, revision 3.30 /cvsroot/mozilla/nsprpub/pr/src/md/unix/unix.c, revisions 3.39, 3.40
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.