PR_EnableClockInterrupts calls _PR_InitStuff.

RESOLVED FIXED in 4.1

Status

defect
P3
normal
RESOLVED FIXED
19 years ago
19 years ago

People

(Reporter: wtc, Assigned: wtc)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Assignee

Description

19 years ago
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.
Assignee

Updated

19 years ago
Status: NEW → ASSIGNED
Target Milestone: --- → 4.1
Assignee

Comment 1

19 years ago
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: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.