Closed Bug 23694 Opened 25 years ago Closed 25 years ago

Enable the NT native-threads-only mode by a global variable

Categories

(NSPR :: NSPR, enhancement, P3)

x86
Windows NT
enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(2 files)

Right now one enables the NT native-threads-only mode by
setting the environment variable NSPR_NATIVE_THREADS_ONLY
to 1.  Although each process has its own environment,
all NT services inherit the *system* environment. This
means the NT services using NSPR cannot have different
settings of the native-threads-only mode.

It is proposed that we add a new way to enable the
native-threads-only mode that allows individual NT
services to have different settings.  We can achieve this
by having the main executable defining a DLL-exported
global variable, and having NSPR look up that global
variable during initialization.

Suppose the global variable is named nspr_native_threads_only.
A server that wants to enable the native-threads-only mode
would define this variable in a file that is part of the main
executable program as follows:

#ifdef WINNT
/* enable NSPR native-threads-only mode */
PR_IMPLEMENT_DATA(PRBool) nspr_native_threads_only = PR_TRUE;
#endif

I suggest that this new method have precedence over the old environment
variable method.  That is, if the nspr_native_threads_only
global variable is defined, NSPR ignores the NSPR_NATIVE_THREADS_ONLY
environment variable.
Attached patch Proposed patch.Splinter Review
Status: NEW → ASSIGNED
Some comments on the proposed patch:
1. The magic global variable "nspr_native_threads_only"
   is of the type PRBool.  It must be defined in the main
   executable using the DLL-export qualifier (e.g., the
   PR_IMPLEMENT_DATA macro).
2. The magic global variable has precedence over the
   magic environment variable.
The patch looks good. It can be made more general to allow setting or resetting
of the native-threads-only mode when nspr_native_threads_only is PR_TRUE and
PR_FALSE respectively, independent of the default mode. Same applies for the
environment variable.
Patch looks good.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
The fix is checked in.
/cvsroot/mozilla/nsprpub/pr/src/misc/prinit.c, revision 3.18

The fix is also checked into the internal repository.
/m/src/ns/nspr20/pr/src/misc/prinit.c, revision 2.38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: