Closed
Bug 54307
Opened 25 years ago
Closed 25 years ago
jsdtoa.c - InitDtoa does not destroy locks
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
People
(Reporter: jonsmirl, Assigned: mike+mozilla)
Details
Attachments
(6 files)
1.06 KB,
patch
|
Details | Diff | Splinter Review | |
1.13 KB,
patch
|
Details | Diff | Splinter Review | |
1.14 KB,
patch
|
Details | Diff | Splinter Review | |
1.14 KB,
patch
|
Details | Diff | Splinter Review | |
1.39 KB,
patch
|
Details | Diff | Splinter Review | |
1.39 KB,
patch
|
Details | Diff | Splinter Review |
These two locks are created but never destroyed.
#ifdef JS_THREADSAFE
static JSBool initialized = JS_FALSE;
/* hacked replica of nspr _PR_InitDtoa */
static void InitDtoa(void)
{
freelist_lock = PR_NewLock();
p5s_lock = PR_NewLock();
initialized = JS_TRUE;
}
#endif
Following patch adds static function TermDtoa() to jsdtoa.c. js_CleanupLocks is
modified to call TermDtoa and cleanup jsdtoa.
patch is not quite right. It needs to test to make sure the static have been
initialized.
void TermDtoa(void)
{
if (initialized == JS_TRUE)
{
PR_DestroyLock(freelist_lock);
PR_DestroyLock(p5s_lock);
}
initialized = JS_FALSE;
}
Comment 3•25 years ago
|
||
cc'ing Brendan and mccabe
Comment 4•25 years ago
|
||
The patch looks ok, but could you please prefix TermDtoa with js_ to avoid
polluting the global C/C++ namespace? Thanks.
/be
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 6•25 years ago
|
||
Jon, the extern js_TermDtoa(void); prototype is missing a void return type after
the extern keyword. Fix that, an a=brendan@mozilla.org (mccabe or rogerl can r=
and check into the trunk).
/be
Assignee | ||
Comment 7•25 years ago
|
||
Maybe it's just me, but js_TermDtoa seems like an ambiguous name.
js_FinishDtoa? Also, I wonder if it makes sense to put the extern declaration
in jsdtoa.h. It's part of the API requirement now...
The PR_DestroyLock calls in js_TermDtoa should be within a #ifdef JS_THREADSAFE,
as they refer to locks that are only defined for JS_THREADSAFE builds.
I'd leave the rest of js_TermDtoa outside of JS_THREADSAFE, (even though it
doesn't do much) so that the API stays the same, threadsafe or no.
Assignee: rogerl → mccabe
Comment 8•25 years ago
|
||
mccabe: good point about js_Finish vs. js_Term -- I promulgated the Init :
Finish :: New : Destroy long ago in SpiderMonkey's naming conventions, how could
I forget? I think I dimly recalled a Term vs. Init antonym and thought maybe
that meme was in jsdtoa.c (code not original to SpiderMonkey), but I should've
checked.
Also, jsdtoa.h hosting the extern sounds fine. Sometimes, with one-off externs
it pays to put the extern in the "importing" .c file and avoid over-including
the .h file. If jslock.c doesn't really need anything else from jsdtoa.h (as I
believe is the case), then I'm ok with a "one-off extern in the importer" here.
/be
Comment 10•25 years ago
|
||
Ok, I can a=brendan@mozilla.org that last patch, without conditions. Thanks
Jon. mccabe, you ok with the one-off extern?
/be
Reporter | ||
Comment 11•25 years ago
|
||
Reporter | ||
Comment 12•25 years ago
|
||
Reporter | ||
Comment 13•25 years ago
|
||
Assignee | ||
Comment 14•25 years ago
|
||
Fix checked in.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•