зеркало из https://github.com/mozilla/pjs.git
Backed out the fix for bug 121975. It doesn't work on Windows 95.
Modified Files: configure configure.in WIN32.mk _win95.h w95dllmain.c w95thred.c
This commit is contained in:
Родитель
cf78c6ba14
Коммит
70f523a4d1
|
@ -1,166 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998-2000 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the
|
||||
# terms of the GNU General Public License Version 2 or later (the
|
||||
# "GPL"), in which case the provisions of the GPL are applicable
|
||||
# instead of those above. If you wish to allow use of your
|
||||
# version of this file only under the terms of the GPL and not to
|
||||
# allow others to use your version of this file under the MPL,
|
||||
# indicate your decision by deleting the provisions above and
|
||||
# replace them with the notice and other provisions required by
|
||||
# the GPL. If you do not delete the provisions above, a recipient
|
||||
# may use your version of this file under either the MPL or the
|
||||
# GPL.
|
||||
#
|
||||
|
||||
#
|
||||
# Configuration common to all versions of Windows NT
|
||||
# and Windows 95.
|
||||
#
|
||||
|
||||
#
|
||||
# Client build: make sure we use the shmsdos.exe under $(MOZ_TOOLS).
|
||||
# $(MOZ_TOOLS_FLIPPED) is $(MOZ_TOOLS) with all the backslashes
|
||||
# flipped, so that gmake won't interpret them as escape characters.
|
||||
#
|
||||
ifdef PR_CLIENT_BUILD_WINDOWS
|
||||
SHELL := $(MOZ_TOOLS_FLIPPED)/bin/shmsdos.exe
|
||||
endif
|
||||
|
||||
CC = cl
|
||||
CCC = cl
|
||||
LINK = link
|
||||
AR = lib -NOLOGO -OUT:"$@"
|
||||
RANLIB = echo
|
||||
BSDECHO = echo
|
||||
STRIP = echo
|
||||
NSINSTALL = nsinstall
|
||||
INSTALL = $(NSINSTALL)
|
||||
define MAKE_OBJDIR
|
||||
if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
|
||||
endef
|
||||
RC = rc.exe
|
||||
|
||||
GARBAGE = $(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb
|
||||
|
||||
XP_DEFINE = -DXP_PC
|
||||
OBJ_SUFFIX = obj
|
||||
LIB_SUFFIX = lib
|
||||
DLL_SUFFIX = dll
|
||||
|
||||
OS_CFLAGS = -W3 -nologo -GF -Gy
|
||||
|
||||
ifdef BUILD_OPT
|
||||
OS_CFLAGS += -MD
|
||||
OPTIMIZER = -O2
|
||||
DEFINES = -UDEBUG -U_DEBUG -DNDEBUG
|
||||
DLLFLAGS = -OUT:"$@"
|
||||
OBJDIR_TAG = _OPT
|
||||
|
||||
# Add symbolic information for use by a profiler
|
||||
ifdef MOZ_PROFILE
|
||||
OPTIMIZER += -Z7
|
||||
DLLFLAGS += -DEBUG -DEBUGTYPE:CV
|
||||
LDFLAGS += -DEBUG -DEBUGTYPE:CV
|
||||
endif
|
||||
|
||||
else
|
||||
#
|
||||
# Define USE_DEBUG_RTL if you want to use the debug runtime library
|
||||
# (RTL) in the debug build
|
||||
#
|
||||
ifdef USE_DEBUG_RTL
|
||||
OS_CFLAGS += -MDd
|
||||
else
|
||||
OS_CFLAGS += -MD
|
||||
endif
|
||||
OPTIMIZER = -Od -Z7
|
||||
#OPTIMIZER = -Zi -Fd$(OBJDIR)/ -Od
|
||||
DEFINES = -DDEBUG -D_DEBUG -UNDEBUG
|
||||
|
||||
DLLFLAGS = -DEBUG -DEBUGTYPE:CV -OUT:"$@"
|
||||
ifdef GLOWCODE
|
||||
DLLFLAGS = -DEBUG -DEBUGTYPE:both -INCLUDE:_GlowCode -OUT:"$@"
|
||||
endif
|
||||
|
||||
OBJDIR_TAG = _DBG
|
||||
LDFLAGS = -DEBUG -DEBUGTYPE:CV
|
||||
#
|
||||
# When PROFILE=1 is defined, set the compile and link options
|
||||
# to build targets for use by the ms-win32 profiler
|
||||
#
|
||||
ifdef PROFILE
|
||||
LDFLAGS += -PROFILE -MAP
|
||||
DLLFLAGS += -PROFILE -MAP
|
||||
endif
|
||||
endif
|
||||
|
||||
DEFINES += -DWIN32
|
||||
|
||||
#
|
||||
# NSPR uses both fibers and static thread-local storage
|
||||
# (i.e., __declspec(thread) variables) on NT. We need the -GT
|
||||
# flag to turn off certain compiler optimizations so that fibers
|
||||
# can use static TLS safely.
|
||||
#
|
||||
# Also, we optimize for Pentium (-G5) on NT.
|
||||
#
|
||||
ifeq ($(OS_TARGET),WINNT)
|
||||
OS_CFLAGS += -GT
|
||||
ifeq ($(CPU_ARCH),x86)
|
||||
OS_CFLAGS += -G5
|
||||
endif
|
||||
DEFINES += -DWINNT
|
||||
else
|
||||
DEFINES += -DWIN95 -D_PR_GLOBAL_THREADS_ONLY
|
||||
endif
|
||||
|
||||
ifeq ($(CPU_ARCH),x86)
|
||||
DEFINES += -D_X86_
|
||||
else
|
||||
ifeq ($(CPU_ARCH),MIPS)
|
||||
DEFINES += -D_MIPS_
|
||||
else
|
||||
ifeq ($(CPU_ARCH),ALPHA)
|
||||
DEFINES += -D_ALPHA_=1
|
||||
else
|
||||
CPU_ARCH = processor_is_undefined
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Name of the binary code directories
|
||||
|
||||
ifeq ($(CPU_ARCH),x86)
|
||||
CPU_ARCH_TAG =
|
||||
else
|
||||
CPU_ARCH_TAG = $(CPU_ARCH)
|
||||
endif
|
||||
|
||||
ifdef USE_DEBUG_RTL
|
||||
OBJDIR_SUFFIX = OBJD
|
||||
else
|
||||
OBJDIR_SUFFIX = OBJ
|
||||
endif
|
||||
|
||||
OBJDIR_NAME = $(OS_CONFIG)$(CPU_ARCH_TAG)$(OBJDIR_TAG).$(OBJDIR_SUFFIX)
|
||||
|
||||
OS_DLLFLAGS = -nologo -DLL -SUBSYSTEM:WINDOWS -PDB:NONE
|
|
@ -3796,6 +3796,13 @@ EOF
|
|||
fi
|
||||
fi # GNU_CC
|
||||
|
||||
if test -n "$USE_STATIC_TLS"; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define _PR_USE_STATIC_TLS 1
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
if test "$OS_TARGET" = "WINNT"; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define WINNT 1
|
||||
|
@ -4152,17 +4159,17 @@ EOF
|
|||
|
||||
ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
|
||||
echo "configure:4156: checking for machine/builtins.h" >&5
|
||||
echo "configure:4163: checking for machine/builtins.h" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4161 "configure"
|
||||
#line 4168 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <machine/builtins.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:4166: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:4173: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
|
@ -4677,12 +4684,12 @@ esac
|
|||
if test -z "$SKIP_LIBRARY_CHECKS"; then
|
||||
|
||||
echo $ac_n "checking for dlopen""... $ac_c" 1>&6
|
||||
echo "configure:4681: checking for dlopen" >&5
|
||||
echo "configure:4688: checking for dlopen" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4686 "configure"
|
||||
#line 4693 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char dlopen(); below. */
|
||||
|
@ -4705,7 +4712,7 @@ dlopen();
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_dlopen=yes"
|
||||
else
|
||||
|
@ -4724,7 +4731,7 @@ else
|
|||
echo "$ac_t""no" 1>&6
|
||||
|
||||
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
|
||||
echo "configure:4728: checking for dlopen in -ldl" >&5
|
||||
echo "configure:4735: checking for dlopen in -ldl" >&5
|
||||
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
|
@ -4732,7 +4739,7 @@ else
|
|||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-ldl $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4736 "configure"
|
||||
#line 4743 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
|
@ -4743,7 +4750,7 @@ int main() {
|
|||
dlopen()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
|
@ -4771,13 +4778,13 @@ fi
|
|||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
|
||||
echo "configure:4775: checking whether ${CC-cc} needs -traditional" >&5
|
||||
echo "configure:4782: checking whether ${CC-cc} needs -traditional" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_pattern="Autoconf.*'x'"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4781 "configure"
|
||||
#line 4788 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sgtty.h>
|
||||
Autoconf TIOCGETP
|
||||
|
@ -4795,7 +4802,7 @@ rm -f conftest*
|
|||
|
||||
if test $ac_cv_prog_gcc_traditional = no; then
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4799 "configure"
|
||||
#line 4806 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <termio.h>
|
||||
Autoconf TCGETA
|
||||
|
@ -4819,12 +4826,12 @@ fi
|
|||
for ac_func in lchown strerror
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:4823: checking for $ac_func" >&5
|
||||
echo "configure:4830: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4828 "configure"
|
||||
#line 4835 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
|
@ -4847,7 +4854,7 @@ $ac_func();
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
|
@ -4885,7 +4892,7 @@ fi
|
|||
|
||||
|
||||
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
|
||||
echo "configure:4889: checking for pthread_create in -lpthreads" >&5
|
||||
echo "configure:4896: checking for pthread_create in -lpthreads" >&5
|
||||
echo "
|
||||
#include <pthread.h>
|
||||
void *foo(void *v) { int a = 1; }
|
||||
|
@ -4907,7 +4914,7 @@ echo "
|
|||
echo "$ac_t""no" 1>&6
|
||||
|
||||
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
|
||||
echo "configure:4911: checking for pthread_create in -lpthread" >&5
|
||||
echo "configure:4918: checking for pthread_create in -lpthread" >&5
|
||||
echo "
|
||||
#include <pthread.h>
|
||||
void *foo(void *v) { int a = 1; }
|
||||
|
@ -4929,7 +4936,7 @@ echo "
|
|||
echo "$ac_t""no" 1>&6
|
||||
|
||||
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
|
||||
echo "configure:4933: checking for pthread_create in -lc_r" >&5
|
||||
echo "configure:4940: checking for pthread_create in -lc_r" >&5
|
||||
echo "
|
||||
#include <pthread.h>
|
||||
void *foo(void *v) { int a = 1; }
|
||||
|
@ -4951,7 +4958,7 @@ echo "
|
|||
echo "$ac_t""no" 1>&6
|
||||
|
||||
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
|
||||
echo "configure:4955: checking for pthread_create in -lc" >&5
|
||||
echo "configure:4962: checking for pthread_create in -lc" >&5
|
||||
echo "
|
||||
#include <pthread.h>
|
||||
void *foo(void *v) { int a = 1; }
|
||||
|
@ -5101,7 +5108,7 @@ if test -n "$USE_PTHREADS"; then
|
|||
rm -f conftest*
|
||||
ac_cv_have_dash_pthread=no
|
||||
echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
|
||||
echo "configure:5105: checking whether ${CC-cc} accepts -pthread" >&5
|
||||
echo "configure:5112: checking whether ${CC-cc} accepts -pthread" >&5
|
||||
echo 'int main() { return 0; }' | cat > conftest.c
|
||||
${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
|
||||
if test $? -eq 0; then
|
||||
|
@ -5124,7 +5131,7 @@ echo "configure:5105: checking whether ${CC-cc} accepts -pthread" >&5
|
|||
ac_cv_have_dash_pthreads=no
|
||||
if test "$ac_cv_have_dash_pthread" = "no"; then
|
||||
echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
|
||||
echo "configure:5128: checking whether ${CC-cc} accepts -pthreads" >&5
|
||||
echo "configure:5135: checking whether ${CC-cc} accepts -pthreads" >&5
|
||||
echo 'int main() { return 0; }' | cat > conftest.c
|
||||
${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
|
||||
if test $? -eq 0; then
|
||||
|
|
|
@ -1247,6 +1247,10 @@ case "$target" in
|
|||
fi
|
||||
fi # GNU_CC
|
||||
|
||||
if test -n "$USE_STATIC_TLS"; then
|
||||
AC_DEFINE(_PR_USE_STATIC_TLS)
|
||||
fi
|
||||
|
||||
if test "$OS_TARGET" = "WINNT"; then
|
||||
AC_DEFINE(WINNT)
|
||||
else
|
||||
|
|
|
@ -409,55 +409,31 @@ extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
|
|||
|
||||
extern struct PRThread * _MD_CURRENT_THREAD(void);
|
||||
|
||||
extern BOOL _pr_use_static_tls;
|
||||
|
||||
#ifdef _PR_USE_STATIC_TLS
|
||||
extern __declspec(thread) struct PRThread *_pr_currentThread;
|
||||
extern DWORD _pr_currentThreadIndex;
|
||||
|
||||
#define _MD_GET_ATTACHED_THREAD() \
|
||||
(_pr_use_static_tls ? _pr_currentThread \
|
||||
: (PRThread *) TlsGetValue(_pr_currentThreadIndex))
|
||||
|
||||
#define _MD_SET_CURRENT_THREAD(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (_pr_use_static_tls) { \
|
||||
_pr_currentThread = (_thread); \
|
||||
} else { \
|
||||
TlsSetValue(_pr_currentThreadIndex, (_thread)); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#define _MD_GET_ATTACHED_THREAD() _pr_currentThread
|
||||
#define _MD_SET_CURRENT_THREAD(_thread) (_pr_currentThread = (_thread))
|
||||
|
||||
extern __declspec(thread) struct PRThread *_pr_thread_last_run;
|
||||
extern DWORD _pr_lastThreadIndex;
|
||||
|
||||
#define _MD_LAST_THREAD() \
|
||||
(_pr_use_static_tls ? _pr_thread_last_run \
|
||||
: (PRThread *) TlsGetValue(_pr_lastThreadIndex))
|
||||
|
||||
#define _MD_SET_LAST_THREAD(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (_pr_use_static_tls) { \
|
||||
_pr_thread_last_run = 0; \
|
||||
} else { \
|
||||
TlsSetValue(_pr_lastThreadIndex, 0); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#define _MD_LAST_THREAD() _pr_thread_last_run
|
||||
#define _MD_SET_LAST_THREAD(_thread) (_pr_thread_last_run = 0)
|
||||
|
||||
extern __declspec(thread) struct _PRCPU *_pr_currentCPU;
|
||||
#define _MD_CURRENT_CPU() _pr_currentCPU
|
||||
#define _MD_SET_CURRENT_CPU(_cpu) (_pr_currentCPU = 0)
|
||||
#else /* _PR_USE_STATIC_TLS */
|
||||
extern DWORD _pr_currentThreadIndex;
|
||||
#define _MD_GET_ATTACHED_THREAD() ((PRThread *) TlsGetValue(_pr_currentThreadIndex))
|
||||
#define _MD_SET_CURRENT_THREAD(_thread) TlsSetValue(_pr_currentThreadIndex, (_thread))
|
||||
|
||||
extern DWORD _pr_lastThreadIndex;
|
||||
#define _MD_LAST_THREAD() ((PRThread *) TlsGetValue(_pr_lastThreadIndex))
|
||||
#define _MD_SET_LAST_THREAD(_thread) TlsSetValue(_pr_lastThreadIndex, 0)
|
||||
|
||||
extern DWORD _pr_currentCPUIndex;
|
||||
|
||||
#define _MD_CURRENT_CPU() \
|
||||
(_pr_use_static_tls ? _pr_currentCPU \
|
||||
: (struct _PRCPU *) TlsGetValue(_pr_currentCPUIndex))
|
||||
|
||||
#define _MD_SET_CURRENT_CPU(_cpu) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (_pr_use_static_tls) { \
|
||||
_pr_currentCPU = 0; \
|
||||
} else { \
|
||||
TlsSetValue(_pr_currentCPUIndex, 0); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#define _MD_CURRENT_CPU() ((struct _PRCPU *) TlsGetValue(_pr_currentCPUIndex))
|
||||
#define _MD_SET_CURRENT_CPU(_cpu) TlsSetValue(_pr_currentCPUIndex, 0)
|
||||
#endif /* _PR_USE_STATIC_TLS */
|
||||
|
||||
/* --- Scheduler stuff --- */
|
||||
#define LOCK_SCHEDULER() 0
|
||||
|
|
|
@ -36,20 +36,12 @@
|
|||
* The DLL entry point (DllMain) for NSPR.
|
||||
*
|
||||
* This is used to detach threads that were automatically attached by
|
||||
* nspr and to find out whether the NSPR DLL is statically or
|
||||
* dynamically loaded. When dynamically loaded, we cannot use static
|
||||
* thread-local storage. However, static TLS is faster than the
|
||||
* TlsXXX() functions. So we want to use static TLS whenever we can.
|
||||
* A global variable _pr_use_static_tls is set in DllMain() during
|
||||
* process attachment to indicate whether it is safe to use static
|
||||
* TLS or not.
|
||||
* nspr.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <primpl.h>
|
||||
|
||||
extern BOOL _pr_use_static_tls; /* defined in w95thred.c */
|
||||
|
||||
BOOL WINAPI DllMain(
|
||||
HINSTANCE hinstDLL,
|
||||
DWORD fdwReason,
|
||||
|
@ -59,15 +51,6 @@ PRThread *me;
|
|||
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
/*
|
||||
* If lpvReserved is NULL, we are dynamically loaded
|
||||
* and therefore can't use static thread-local storage.
|
||||
*/
|
||||
if (lpvReserved == NULL) {
|
||||
_pr_use_static_tls = FALSE;
|
||||
} else {
|
||||
_pr_use_static_tls = TRUE;
|
||||
}
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
|
|
|
@ -38,13 +38,15 @@
|
|||
extern void _PR_Win32InitTimeZone(void); /* defined in ntmisc.c */
|
||||
|
||||
/* --- globals ------------------------------------------------ */
|
||||
BOOL _pr_use_static_tls = TRUE;
|
||||
#ifdef _PR_USE_STATIC_TLS
|
||||
__declspec(thread) struct PRThread *_pr_thread_last_run;
|
||||
__declspec(thread) struct PRThread *_pr_currentThread;
|
||||
__declspec(thread) struct _PRCPU *_pr_currentCPU;
|
||||
#else
|
||||
DWORD _pr_currentThreadIndex;
|
||||
DWORD _pr_lastThreadIndex;
|
||||
DWORD _pr_currentCPUIndex;
|
||||
#endif
|
||||
int _pr_intsOff = 0;
|
||||
_PRInterruptTable _pr_interruptTable[] = { { 0 } };
|
||||
|
||||
|
@ -53,11 +55,11 @@ _PR_MD_EARLY_INIT()
|
|||
{
|
||||
_PR_Win32InitTimeZone();
|
||||
|
||||
if (!_pr_use_static_tls) {
|
||||
_pr_currentThreadIndex = TlsAlloc();
|
||||
_pr_lastThreadIndex = TlsAlloc();
|
||||
_pr_currentCPUIndex = TlsAlloc();
|
||||
}
|
||||
#ifndef _PR_USE_STATIC_TLS
|
||||
_pr_currentThreadIndex = TlsAlloc();
|
||||
_pr_lastThreadIndex = TlsAlloc();
|
||||
_pr_currentCPUIndex = TlsAlloc();
|
||||
#endif
|
||||
}
|
||||
|
||||
void _PR_MD_CLEANUP_BEFORE_EXIT(void)
|
||||
|
@ -66,11 +68,11 @@ void _PR_MD_CLEANUP_BEFORE_EXIT(void)
|
|||
|
||||
WSACleanup();
|
||||
|
||||
if (!_pr_use_static_tls) {
|
||||
TlsFree(_pr_currentThreadIndex);
|
||||
TlsFree(_pr_lastThreadIndex);
|
||||
TlsFree(_pr_currentCPUIndex);
|
||||
}
|
||||
#ifndef _PR_USE_STATIC_TLS
|
||||
TlsFree(_pr_currentThreadIndex);
|
||||
TlsFree(_pr_lastThreadIndex);
|
||||
TlsFree(_pr_currentCPUIndex);
|
||||
#endif
|
||||
}
|
||||
|
||||
PRStatus
|
||||
|
|
Загрузка…
Ссылка в новой задаче