Closed
Bug 253990
Opened 20 years ago
Closed 6 months ago
nspr based lib (solaris native thread) in single threaded application makes it MT
Categories
(NSPR :: NSPR, defect)
Tracking
(Not tracked)
RESOLVED
INACTIVE
People
(Reporter: gerard.roos, Unassigned)
Details
Attachments
(1 file)
959 bytes,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 Build Identifier: A library built with NSPR on Solaris is multi-threaded only, i.e. such a library turns any single-threaded application into a multi-threaded one. Reproducible: Always Steps to Reproduce: Build a library with NSRP and load it into a single-threaded application. Actual Results: The ST application becomes MT. Expected Results: Application remains ST. The behaviour was detected on Solaris, using NSPR, patched with patches from #214411 (Solaris native thread support), and built with Solaris native thread support.
Reporter | ||
Comment 1•20 years ago
|
||
'-lthread' or '-lpthread' must be removed. Explicit thread library linkage must be done by the application. It's sufficient to make the library MT aware ('-mt' flag).
Reporter | ||
Comment 2•20 years ago
|
||
Additionally (note that we had the patches from bug id #214411 applied), _PRI_AttachThread in() _pr_current_thread_tls() must be given the type PR_SYSTEM_THREAD and the flag _PR_PRIMORDIAL. Latter is necessary for assertion in PR_Cleanup(). Former is necessary for "_pr_userActive > _pr_primordialExitCount" in PR_Cleanup() not to wait forever. I just point out the two affected lines (proposing further patches for NSPR 4.3 (which we are using) makes not much sense here, as the affected files have already been modified by applying the patches from #214411). But since the modifications are simple, a glance at the code should make things clear (and the changes probably also fit into head of NSPR well): 1) mozilla/nsprpub/pr/src/md/unix/solaris.c (in _pr_current_thread_tls(), pass _PR_PRIMORDIAL flag to _PRI_AttachThread): thread = _PRI_AttachThread( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, NULL, _PR_PRIMORDIAL); ^^^^^^^^^^^^^^ 2) mozilla/nsprpub/pr/src/threads/combined/pruthr.c (in _PRI_DetachThread(void), ignore if _PR_PRIMORDIAL): void _PRI_DetachThread(void) { PRThread *me = _PR_MD_CURRENT_THREAD(); if ((me->flags & _PR_PRIMORDIAL) && !(me->flags & _PR_ATTACHED)) { /* * ignore, if primordial thread */ return; } ....
Reporter | ||
Comment 3•20 years ago
|
||
hmm, one thing I forgot to add: On Solaris 2.6 (SunOS 5.6) using native solaris threads, if a library links nspr statically, and that library calls thr_create directly or indirectly (e.g. the call happens in NSPR), the lib itself must be linked with '-lthread', otherwise thr_create returns -1. On Solaris 2.8 (SunOS 5.8) this is not an issue (the lib is not required to be linked with '-lthread').
Updated•18 years ago
|
QA Contact: wtchang → nspr
Updated•5 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Updated•2 years ago
|
Severity: normal → S3
Comment 4•1 year ago
|
||
The bug assignee is inactive on Bugzilla, so the assignee is being reset.
Assignee: wtc → nobody
Status: ASSIGNED → NEW
Updated•6 months ago
|
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → INACTIVE
You need to log in
before you can comment on or make changes to this bug.
Description
•