Bug 1420407, Land NSPR 4.18 into FF 59, NSPR_4_18_BETA5, r=me

UPGRADE_NSPR_RELEASE

--HG--
extra : amend_source : 45e5bf8af53222541f0ff1633647591c8533463a
This commit is contained in:
Kai Engert 2017-12-21 14:58:24 +01:00
Родитель daf96ad175
Коммит 4752d5d427
24 изменённых файлов: 49 добавлений и 388 удалений

Просмотреть файл

@ -1 +1 @@
NSPR_4_18_BETA4
NSPR_4_18_BETA5

Просмотреть файл

@ -10,4 +10,3 @@
*/
#error "Do not include this header file."

15
nsprpub/configure поставляемый
Просмотреть файл

@ -6560,11 +6560,13 @@ fi
$as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h
HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'`
if test "$HOST_DARWIN_MAJOR" -ge 15 ; then
$as_echo "#define HAS_CONNECTX 1" >>confdefs.h
fi
fi
AS='$(CC) -x assembler-with-cpp'
CFLAGS="$CFLAGS -Wall -fno-common"
case "${target_cpu}" in
@ -8472,19 +8474,12 @@ case "$target" in
fi
if test "$USE_PTHREADS"; then
if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
$as_echo "#define _REENTRANT 1" >>confdefs.h
$as_echo "#define _PR_DCETHREADS 1" >>confdefs.h
else
cat >>confdefs.h <<_ACEOF
cat >>confdefs.h <<_ACEOF
#define _POSIX_C_SOURCE 199506L
_ACEOF
$as_echo "#define _PR_HAVE_THREADSAFE_GETHOST 1" >>confdefs.h
$as_echo "#define _PR_HAVE_THREADSAFE_GETHOST 1" >>confdefs.h
fi
fi
if test "$USE_USER_PTHREADS"; then
cat >>confdefs.h <<_ACEOF

Просмотреть файл

@ -2889,13 +2889,8 @@ case "$target" in
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
fi
if test "$USE_PTHREADS"; then
if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
AC_DEFINE(_REENTRANT)
AC_DEFINE(_PR_DCETHREADS)
else
AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
fi
AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
fi
if test "$USE_USER_PTHREADS"; then
AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)

Просмотреть файл

@ -14,29 +14,7 @@
#define _PR_MD_DISABLE_CLOCK_INTERRUPTS()
#define _PR_MD_ENABLE_CLOCK_INTERRUPTS()
/* In good standards fashion, the DCE threads (based on posix-4) are not
* quite the same as newer posix implementations. These are mostly name
* changes and small differences, so macros usually do the trick
*/
#ifdef _PR_DCETHREADS
#define _PT_PTHREAD_MUTEXATTR_INIT pthread_mutexattr_create
#define _PT_PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_delete
#define _PT_PTHREAD_MUTEX_INIT(m, a) pthread_mutex_init(&(m), a)
#define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (0 == pthread_mutex_trylock(&(m)))
#define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_create
#define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), a)
#define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_delete
/* Notes about differences between DCE threads and pthreads 10:
* 1. pthread_mutex_trylock returns 1 when it locks the mutex
* 0 when it does not. The latest pthreads has a set of errno-like
* return values.
* 2. return values from pthread_cond_timedwait are different.
*
*
*
*/
#elif defined(BSDI)
#if defined(BSDI)
/*
* Mutex and condition attributes are not supported. The attr
* argument to pthread_mutex_init() and pthread_cond_init() must
@ -106,13 +84,7 @@
* PR_EnterMonitor calls any of these functions, infinite
* recursion ensues.
*/
#if defined(_PR_DCETHREADS)
#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) \
memset(&(t), 0, sizeof(pthread_t))
#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) \
(!memcmp(&(t), &pt_zero_tid, sizeof(pthread_t)))
#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
#elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
#if defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|| defined(HPUX) || defined(FREEBSD) \
|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
@ -125,17 +97,7 @@
#error "pthreads is not supported for this architecture"
#endif
#if defined(_PR_DCETHREADS)
#define _PT_PTHREAD_ATTR_INIT pthread_attr_create
#define _PT_PTHREAD_ATTR_DESTROY pthread_attr_delete
#define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, a, f, r)
#define _PT_PTHREAD_KEY_CREATE pthread_keycreate
#define _PT_PTHREAD_ATTR_SETSCHEDPOLICY pthread_attr_setsched
#define _PT_PTHREAD_ATTR_GETSTACKSIZE(a, s) \
(*(s) = pthread_attr_getstacksize(*(a)), 0)
#define _PT_PTHREAD_GETSPECIFIC(k, r) \
pthread_getspecific((k), (pthread_addr_t *) &(r))
#elif defined(_PR_PTHREADS)
#if defined(_PR_PTHREADS)
#define _PT_PTHREAD_ATTR_INIT pthread_attr_init
#define _PT_PTHREAD_ATTR_DESTROY pthread_attr_destroy
#define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, &a, f, r)
@ -147,22 +109,6 @@
#error "Cannot determine pthread strategy"
#endif
#if defined(_PR_DCETHREADS)
#define _PT_PTHREAD_EXPLICIT_SCHED _PT_PTHREAD_DEFAULT_SCHED
#endif
/*
* pthread_mutex_trylock returns different values in DCE threads and
* pthreads.
*/
#if defined(_PR_DCETHREADS)
#define PT_TRYLOCK_SUCCESS 1
#define PT_TRYLOCK_BUSY 0
#else
#define PT_TRYLOCK_SUCCESS 0
#define PT_TRYLOCK_BUSY EBUSY
#endif
/*
* These platforms don't have sigtimedwait()
*/
@ -190,16 +136,9 @@
#define PT_PRIO_MIN DEFAULT_PRIO
#define PT_PRIO_MAX DEFAULT_PRIO
#elif defined(HPUX)
#if defined(_PR_DCETHREADS)
#define PT_PRIO_MIN PRI_OTHER_MIN
#define PT_PRIO_MAX PRI_OTHER_MAX
#else /* defined(_PR_DCETHREADS) */
#include <sys/sched.h>
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
#endif /* defined(_PR_DCETHREADS) */
#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|| defined(FREEBSD) || defined(SYMBIAN)
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
@ -238,9 +177,7 @@
* Needed for garbage collection -- Look at PR_Suspend/PR_Resume
* implementation.
*/
#if defined(_PR_DCETHREADS)
#define _PT_PTHREAD_YIELD() pthread_yield()
#elif defined(OSF1)
#if defined(OSF1)
/*
* sched_yield can't be called from a signal handler. Must use
* the _np version.

Просмотреть файл

@ -6,14 +6,6 @@
#ifndef primpl_h___
#define primpl_h___
/*
* HP-UX 10.10's pthread.h (DCE threads) includes dce/cma.h, which
* has:
* #define sigaction _sigaction_sys
* This macro causes chaos if signal.h gets included before pthread.h.
* To be safe, we include pthread.h first.
*/
#if defined(_PR_PTHREADS)
#include <pthread.h>
#endif
@ -1877,7 +1869,7 @@ extern PRFileDesc *_pr_stderr;
** and functions with macros that expand to the native thread
** types and functions on each platform.
*/
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
#define _PR_ZONE_ALLOCATOR
#endif

Просмотреть файл

@ -138,12 +138,8 @@ endif
ifeq ($(OS_ARCH),HP-UX)
ifeq ($(USE_PTHREADS), 1)
ifeq (,$(filter-out B.10.10 B.10.20,$(OS_RELEASE)))
OS_LIBS = -ldce
else
OS_LIBS = -lpthread -lrt
endif
endif
ifeq ($(PTHREADS_USER), 1)
OS_LIBS = -lpthread
endif

Просмотреть файл

@ -2854,28 +2854,11 @@ void _PR_UnixInit(void)
#endif
#endif /* !defined(_PR_PTHREADS) */
/*
* Under HP-UX DCE threads, sigaction() installs a per-thread
* handler, so we use sigvector() to install a process-wide
* handler.
*/
#if defined(HPUX) && defined(_PR_DCETHREADS)
{
struct sigvec vec;
vec.sv_handler = SIG_IGN;
vec.sv_mask = 0;
vec.sv_flags = 0;
rv = sigvector(SIGPIPE, &vec, NULL);
PR_ASSERT(0 == rv);
}
#else
sigact.sa_handler = SIG_IGN;
sigemptyset(&sigact.sa_mask);
sigact.sa_flags = 0;
rv = sigaction(SIGPIPE, &sigact, 0);
PR_ASSERT(0 == rv);
#endif /* HPUX && _PR_DCETHREADS */
_pr_rename_lock = PR_NewLock();
PR_ASSERT(NULL != _pr_rename_lock);

Просмотреть файл

@ -685,10 +685,6 @@ static void pr_SigchldHandler(int sig)
static void pr_InstallSigchldHandler()
{
#if defined(HPUX) && defined(_PR_DCETHREADS)
#error "HP-UX DCE threads have their own SIGCHLD handler"
#endif
struct sigaction act, oact;
int rv;

Просмотреть файл

@ -23,7 +23,7 @@
#if !defined(_PR_HAVE_ATOMIC_OPS)
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
/*
* PR_AtomicDecrement() is used in NSPR's thread-specific data
* destructor. Because thread-specific data destructors may be
@ -190,7 +190,7 @@ _PR_MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval)
pthread_mutex_unlock(&atomic_locks[idx]);
return rv;
}
#else /* _PR_PTHREADS && !_PR_DCETHREADS */
#else /* _PR_PTHREADS */
/*
* We use a single lock for all the emulated atomic operations.
* The lock contention should be acceptable.
@ -259,7 +259,7 @@ _PR_MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval)
PR_Unlock(atomic_lock);
return rv;
}
#endif /* _PR_PTHREADS && !_PR_DCETHREADS */
#endif /* _PR_PTHREADS */
#endif /* !_PR_HAVE_ATOMIC_OPS */

Просмотреть файл

@ -1895,19 +1895,6 @@ static PRInt32 pt_Send(
PRInt32 tmp_amount = amount;
#endif
/*
* Under HP-UX DCE threads, pthread.h includes dce/cma_ux.h,
* which has the following:
* # define send cma_send
* extern int cma_send (int , void *, int, int );
* So we need to cast away the 'const' of argument #2 for send().
*/
#if defined (HPUX) && defined(_PR_DCETHREADS)
#define PT_SENDBUF_CAST (void *)
#else
#define PT_SENDBUF_CAST
#endif
if (pt_TestAbort()) return bytes;
/*
@ -1918,9 +1905,9 @@ static PRInt32 pt_Send(
#if defined(SOLARIS)
PR_ASSERT(0 == flags);
retry:
bytes = write(fd->secret->md.osfd, PT_SENDBUF_CAST buf, tmp_amount);
bytes = write(fd->secret->md.osfd, buf, tmp_amount);
#else
bytes = send(fd->secret->md.osfd, PT_SENDBUF_CAST buf, amount, flags);
bytes = send(fd->secret->md.osfd, buf, amount, flags);
#endif
syserrno = errno;

Просмотреть файл

@ -23,11 +23,6 @@ static pthread_condattr_t _pt_cvar_attr;
#if defined(DEBUG)
extern PTDebug pt_debug; /* this is shared between several modules */
#if defined(_PR_DCETHREADS)
static pthread_t pt_zero_tid; /* a null pthread_t (pthread_t is a struct
* in DCE threads) to compare with */
#endif /* defined(_PR_DCETHREADS) */
#endif /* defined(DEBUG) */
#if defined(FREEBSD)
@ -263,12 +258,7 @@ static PRIntn pt_TimedWait(
rv = pthread_cond_timedwait(cv, ml, &tmo);
/* NSPR doesn't report timeouts */
#ifdef _PR_DCETHREADS
if (rv == -1) return (errno == EAGAIN) ? 0 : errno;
else return rv;
#else
return (rv == ETIMEDOUT) ? 0 : rv;
#endif
} /* pt_TimedWait */
@ -1171,14 +1161,14 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphore(const char *name)
PR_IMPLEMENT(PRStatus) PRP_TryLock(PRLock *lock)
{
PRIntn rv = pthread_mutex_trylock(&lock->mutex);
if (rv == PT_TRYLOCK_SUCCESS)
if (rv == 0)
{
PR_ASSERT(PR_FALSE == lock->locked);
lock->locked = PR_TRUE;
lock->owner = pthread_self();
}
/* XXX set error code? */
return (PT_TRYLOCK_SUCCESS == rv) ? PR_SUCCESS : PR_FAILURE;
return (0 == rv) ? PR_SUCCESS : PR_FAILURE;
} /* PRP_TryLock */
PR_IMPLEMENT(PRCondVar*) PRP_NewNakedCondVar(void)

Просмотреть файл

@ -9,7 +9,7 @@
** Exports: ptthread.h
*/
#if defined(_PR_PTHREADS) || defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
#include "prlog.h"
#include "primpl.h"
@ -58,7 +58,7 @@ static struct _PT_Bookeeping
pthread_key_t key; /* thread private data key */
PRBool keyCreated; /* whether 'key' should be deleted */
PRThread *first, *last; /* list of threads we know about */
#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0
#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
PRInt32 minPrio, maxPrio; /* range of scheduling priorities */
#endif
} pt_book = {0};
@ -67,7 +67,7 @@ static void _pt_thread_death(void *arg);
static void _pt_thread_death_internal(void *arg, PRBool callDestructors);
static void init_pthread_gc_support(void);
#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0
#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
static PRIntn pt_PriorityMap(PRThreadPriority pri)
{
#ifdef NTO
@ -148,21 +148,6 @@ static void *_pt_root(void *arg)
}
#endif
/*
** DCE Threads can't detach during creation, so do it late.
** I would like to do it only here, but that doesn't seem
** to work.
*/
#if defined(_PR_DCETHREADS)
if (detached)
{
/* pthread_detach() modifies its argument, so we must pass a copy */
pthread_t self = id;
rv = pthread_detach(&self);
PR_ASSERT(0 == rv);
}
#endif /* defined(_PR_DCETHREADS) */
/* Set up the thread stack information */
_PR_InitializeStack(thred->stack);
@ -329,7 +314,7 @@ static PRThread* _PR_CreateThread(
if (EPERM != pt_schedpriv)
{
#if !defined(_PR_DCETHREADS) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0
#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
struct sched_param schedule;
#endif
@ -340,10 +325,7 @@ static PRThread* _PR_CreateThread(
/* Use the default scheduling policy */
#if defined(_PR_DCETHREADS)
rv = pthread_attr_setprio(&tattr, pt_PriorityMap(priority));
PR_ASSERT(0 == rv);
#elif _POSIX_THREAD_PRIORITY_SCHEDULING > 0
#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
rv = pthread_attr_getschedparam(&tattr, &schedule);
PR_ASSERT(0 == rv);
schedule.sched_priority = pt_PriorityMap(priority);
@ -353,19 +335,13 @@ static PRThread* _PR_CreateThread(
rv = pthread_attr_setschedpolicy(&tattr, SCHED_RR); /* Round Robin */
PR_ASSERT(0 == rv);
#endif
#endif /* !defined(_PR_DCETHREADS) */
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING > 0 */
}
/*
* DCE threads can't set detach state before creating the thread.
* AIX can't set detach late. Why can't we all just get along?
*/
#if !defined(_PR_DCETHREADS)
rv = pthread_attr_setdetachstate(&tattr,
((PR_JOINABLE_THREAD == state) ?
PTHREAD_CREATE_JOINABLE : PTHREAD_CREATE_DETACHED));
PR_ASSERT(0 == rv);
#endif /* !defined(_PR_DCETHREADS) */
/*
* If stackSize is 0, we use the default pthread stack size.
@ -456,7 +432,6 @@ static PRThread* _PR_CreateThread(
*/
rv = _PT_PTHREAD_CREATE(&id, tattr, _pt_root, thred);
#if !defined(_PR_DCETHREADS)
if (EPERM == rv)
{
#if defined(IRIX)
@ -482,15 +457,10 @@ static PRThread* _PR_CreateThread(
#endif /* IRIX */
rv = _PT_PTHREAD_CREATE(&id, tattr, _pt_root, thred);
}
#endif
if (0 != rv)
{
#if defined(_PR_DCETHREADS)
PRIntn oserr = errno;
#else
PRIntn oserr = rv;
#endif
PR_Lock(pt_book.ml);
if (thred->state & PT_THREAD_SYSTEM)
pt_book.system -= 1;
@ -602,10 +572,6 @@ PR_IMPLEMENT(PRStatus) PR_JoinThread(PRThread *thred)
PR_ASSERT(rv == 0 && result == NULL);
if (0 == rv)
{
#ifdef _PR_DCETHREADS
rv = pthread_detach(&id);
PR_ASSERT(0 == rv);
#endif
/*
* PR_FALSE, because the thread already called the TPD
* destructors before exiting _pt_root.
@ -693,10 +659,7 @@ PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thred, PRThreadPriority newPri
else if ((PRIntn)PR_PRIORITY_LAST < (PRIntn)newPri)
newPri = PR_PRIORITY_LAST;
#if defined(_PR_DCETHREADS)
rv = pthread_setprio(thred->id, pt_PriorityMap(newPri));
/* pthread_setprio returns the old priority */
#elif _POSIX_THREAD_PRIORITY_SCHEDULING > 0
#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
if (EPERM != pt_schedpriv)
{
int policy;
@ -927,7 +890,7 @@ void _PR_InitThreads(
pthread_init();
#endif
#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0
#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
#if defined(FREEBSD)
{
pthread_attr_t attr;
@ -1161,11 +1124,7 @@ PR_IMPLEMENT(void) PR_ProcessExit(PRIntn status)
PR_IMPLEMENT(PRUint32) PR_GetThreadID(PRThread *thred)
{
#if defined(_PR_DCETHREADS)
return (PRUint32)&thred->id; /* this is really a sham! */
#else
return (PRUint32)thred->id; /* and I don't know what they will do with it */
#endif
}
/*
@ -1197,18 +1156,6 @@ PR_SetThreadDumpProc(PRThread* thread, PRThreadDumpProc dump, void *arg)
* Garbage collection support follows.
*/
#if defined(_PR_DCETHREADS)
/*
* statics for Garbage Collection support. We don't need to protect these
* signal masks since the garbage collector itself is protected by a lock
* and multiple threads will not be garbage collecting at the same time.
*/
static sigset_t javagc_vtalarm_sigmask;
static sigset_t javagc_intsoff_sigmask;
#else /* defined(_PR_DCETHREADS) */
/* a bogus signal mask for forcing a timed wait */
/* Not so bogus in AIX as we really do a sigwait */
static sigset_t sigwait_set;
@ -1224,8 +1171,6 @@ static void suspend_signal_handler(PRIntn sig);
static void null_signal_handler(PRIntn sig);
#endif
#endif /* defined(_PR_DCETHREADS) */
/*
* Linux pthreads use SIGUSR1 and SIGUSR2 internally, which
* conflict with the use of these two signals in our GC support.
@ -1236,12 +1181,6 @@ static void init_pthread_gc_support(void)
#ifndef SYMBIAN
PRIntn rv;
#if defined(_PR_DCETHREADS)
rv = sigemptyset(&javagc_vtalarm_sigmask);
PR_ASSERT(0 == rv);
rv = sigaddset(&javagc_vtalarm_sigmask, SIGVTALRM);
PR_ASSERT(0 == rv);
#else /* defined(_PR_DCETHREADS) */
{
struct sigaction sigact_usr2;
@ -1269,7 +1208,6 @@ static void init_pthread_gc_support(void)
PR_ASSERT(0 ==rv);
}
#endif /* defined(PT_NO_SIGTIMEDWAIT) */
#endif /* defined(_PR_DCETHREADS) */
#endif /* SYMBIAN */
}
@ -1300,9 +1238,7 @@ PR_IMPLEMENT(PRStatus) PR_EnumerateThreads(PREnumerator func, void *arg)
PRThread* thred = pt_book.first;
#if defined(DEBUG) || defined(FORCE_PR_ASSERT)
#if !defined(_PR_DCETHREADS)
PRThread *me = PR_GetCurrentThread();
#endif
#endif
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin PR_EnumerateThreads\n"));
@ -1331,9 +1267,7 @@ PR_IMPLEMENT(PRStatus) PR_EnumerateThreads(PREnumerator func, void *arg)
if (_PT_IS_GCABLE_THREAD(thred))
{
#if !defined(_PR_DCETHREADS)
PR_ASSERT((thred == me) || (thred->suspend & PT_THREAD_SUSPENDED));
#endif
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS,
("In PR_EnumerateThreads callback thread %p thid = %X\n",
thred, thred->id));
@ -1361,8 +1295,6 @@ PR_IMPLEMENT(PRStatus) PR_EnumerateThreads(PREnumerator func, void *arg)
* proceed until the thread is suspended or resumed.
*/
#if !defined(_PR_DCETHREADS)
/*
* In the signal handler, we can not use condition variable notify or wait.
* This does not work consistently across all pthread platforms. We also can not
@ -1661,78 +1593,6 @@ PR_IMPLEMENT(void *)PR_GetSP(PRThread *thred)
return thred->sp;
} /* PR_GetSP */
#else /* !defined(_PR_DCETHREADS) */
static pthread_once_t pt_gc_support_control = pthread_once_init;
/*
* For DCE threads, there is no pthread_kill or a way of suspending or resuming a
* particular thread. We will just disable the preemption (virtual timer alarm) and
* let the executing thread finish the garbage collection. This stops all other threads
* (GC able or not) and is very inefficient but there is no other choice.
*/
PR_IMPLEMENT(void) PR_SuspendAll()
{
PRIntn rv;
rv = pthread_once(&pt_gc_support_control, init_pthread_gc_support);
PR_ASSERT(0 == rv); /* returns -1 on failure */
#ifdef DEBUG
suspendAllOn = PR_TRUE;
#endif
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin PR_SuspendAll\n"));
/*
* turn off preemption - i.e add virtual alarm signal to the set of
* blocking signals
*/
rv = sigprocmask(
SIG_BLOCK, &javagc_vtalarm_sigmask, &javagc_intsoff_sigmask);
PR_ASSERT(0 == rv);
suspendAllSuspended = PR_TRUE;
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("End PR_SuspendAll\n"));
} /* PR_SuspendAll */
PR_IMPLEMENT(void) PR_ResumeAll()
{
PRIntn rv;
suspendAllSuspended = PR_FALSE;
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin PR_ResumeAll\n"));
/* turn on preemption - i.e re-enable virtual alarm signal */
rv = sigprocmask(SIG_SETMASK, &javagc_intsoff_sigmask, (sigset_t *)NULL);
PR_ASSERT(0 == rv);
#ifdef DEBUG
suspendAllOn = PR_FALSE;
#endif
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("End PR_ResumeAll\n"));
} /* PR_ResumeAll */
/* Return the stack pointer for the given thread- used by the GC */
PR_IMPLEMENT(void*)PR_GetSP(PRThread *thred)
{
pthread_t tid = thred->id;
char *thread_tcb, *top_sp;
/*
* For HPUX DCE threads, pthread_t is a struct with the
* following three fields (see pthread.h, dce/cma.h):
* cma_t_address field1;
* short int field2;
* short int field3;
* where cma_t_address is typedef'd to be either void*
* or char*.
*/
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin PR_GetSP\n"));
thread_tcb = (char*)tid.field1;
top_sp = *(char**)(thread_tcb + 128);
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("End PR_GetSP %p \n", top_sp));
return top_sp;
} /* PR_GetSP */
#endif /* !defined(_PR_DCETHREADS) */
PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
{
PRThread *thread;
@ -1817,6 +1677,6 @@ PR_IMPLEMENT(const char *) PR_GetThreadName(const PRThread *thread)
return thread->name;
}
#endif /* defined(_PR_PTHREADS) || defined(_PR_DCETHREADS) */
#endif /* defined(_PR_PTHREADS) */
/* ptthread.c */

Просмотреть файл

@ -7,7 +7,7 @@
#include <string.h>
#if defined(HPUX) && defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(HPUX) && defined(_PR_PTHREADS)
#include <pthread.h>
#define HAVE_UNIX98_RWLOCK

Просмотреть файл

@ -373,9 +373,6 @@ endif
ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS QNX Darwin OpenUNIX,$(OS_ARCH)))
LIBPTHREAD =
endif
ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10)
LIBPTHREAD = -ldce
endif
endif
ifeq ($(OS_TARGET),Android)

Просмотреть файл

@ -111,16 +111,6 @@ static int32 threadStartFunc(void *arg)
static void * threadStartFunc(void *arg)
#endif
{
#ifdef _PR_DCETHREADS
{
int rv;
pthread_t self = pthread_self();
rv = pthread_detach(&self);
if (debug_mode) PR_ASSERT(0 == rv);
else if (0 != rv) failed_already=1;
}
#endif
Measure(AttachDetach, "Attach/Detach");
#ifndef IRIX
@ -206,14 +196,12 @@ int main(int argc, char **argv)
goto exit_now;
}
#ifndef _PR_DCETHREADS
rv = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
if (debug_mode) PR_ASSERT(0 == rv);
else if (0 != rv) {
failed_already=1;
goto exit_now;
}
#endif /* !_PR_DCETHREADS */
rv = _PT_PTHREAD_CREATE(&threadID, attr, threadStartFunc, NULL);
if (rv != 0) {
fprintf(stderr, "thread creation failed: error code %d\n", rv);

Просмотреть файл

@ -29,8 +29,6 @@
#include <stdio.h>
#include <stdlib.h>
#if defined(_PR_DCETHREADS)
PRIntn failed_already=0;
PRIntn debug_mode=0;
@ -80,20 +78,13 @@ static PRIntn prmain(PRIntn argc, char **argv)
} /* prmain */
#endif /* #if defined(_PR_DCETHREADS) */
int main(int argc, char **argv)
{
#if defined(_PR_DCETHREADS)
PR_Initialize(prmain, argc, argv, 0);
if(failed_already)
return 1;
else
return 0;
#else
return 0;
#endif
} /* main */

Просмотреть файл

@ -52,7 +52,7 @@ static int _debug_on = 0;
#define DPRINTF(arg) if (_debug_on) PR_fprintf arg
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
#include <pthread.h>
#include "md/_pth.h"
static void *pthread_start(void *arg)
@ -63,7 +63,7 @@ static void *pthread_start(void *arg)
start(data);
return NULL;
} /* pthread_start */
#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
#endif /* defined(_PR_PTHREADS) */
#if defined(IRIX) && !defined(_PR_PTHREADS)
#include <sys/types.h>
@ -109,7 +109,7 @@ static PRStatus NSPRPUB_TESTS_CreateThread(StartFn start, void *arg)
}
break;
case thread_pthread:
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
{
int rv;
pthread_t id;
@ -137,7 +137,7 @@ static PRStatus NSPRPUB_TESTS_CreateThread(StartFn start, void *arg)
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
rv = PR_FAILURE;
break;
#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
#endif /* defined(_PR_PTHREADS) */
case thread_sproc:
#if defined(IRIX) && !defined(_PR_PTHREADS)

Просмотреть файл

@ -196,51 +196,6 @@ finish:
return;
}
#ifdef _PR_DCETHREADS
#include <syscall.h>
pid_t PR_UnixFork1(void)
{
pid_t parent = getpid();
int rv = syscall(SYS_fork);
if (rv == -1) {
return (pid_t) -1;
} else {
/* For each process, rv is the pid of the other process */
if (rv == parent) {
/* the child */
return 0;
} else {
/* the parent */
return rv;
}
}
}
#elif defined(SOLARIS)
/*
* It seems like that in Solaris 2.4 one must call fork1() if the
* the child process is going to use thread functions. Solaris 2.5
* doesn't have this problem. Calling fork() also works.
*/
pid_t PR_UnixFork1(void)
{
return fork1();
}
#else
pid_t PR_UnixFork1(void)
{
return fork();
}
#endif /* PR_DCETHREADS */
int main(int argc, char **argv)
{
pid_t pid;
@ -250,7 +205,7 @@ int main(int argc, char **argv)
DoIO();
pid = PR_UnixFork1();
pid = fork();
if (pid == (pid_t) -1) {
fprintf(stderr, "Fork failed: errno %d\n", errno);

Просмотреть файл

@ -606,7 +606,7 @@ typedef struct StartObject
void *arg;
} StartObject;
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
#include "md/_pth.h"
#include <pthread.h>
@ -619,7 +619,7 @@ static void *pthread_start(void *arg)
start(data);
return NULL;
} /* pthread_start */
#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
#endif /* defined(_PR_PTHREADS) */
#if defined(IRIX) && !defined(_PR_PTHREADS)
#include <sys/types.h>
@ -657,10 +657,10 @@ static PRStatus JoinThread(PRThread *thread)
rv = PR_JoinThread(thread);
break;
case thread_pthread:
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
rv = PR_SUCCESS;
break;
#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
#endif /* defined(_PR_PTHREADS) */
case thread_win32:
#if defined(WIN32)
rv = PR_SUCCESS;
@ -690,7 +690,7 @@ static PRStatus NewThread(
}
break;
case thread_pthread:
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
{
int rv;
pthread_t id;
@ -717,7 +717,7 @@ static PRStatus NewThread(
#else
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
rv = PR_FAILURE;
#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
#endif /* defined(_PR_PTHREADS) */
break;
case thread_sproc:

Просмотреть файл

@ -21,7 +21,7 @@
#ifdef XP_UNIX
#include <sys/mman.h>
#endif
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
#include <pthread.h>
#endif
@ -313,7 +313,7 @@ PRThread* create_new_thread(PRThreadType type,
PRInt32 native_thread = 0;
PR_ASSERT(state == PR_UNJOINABLE_THREAD);
#if (defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)) || defined(WIN32)
#if defined(_PR_PTHREADS) || defined(WIN32)
switch(index % 4) {
case 0:
scope = (PR_LOCAL_THREAD);
@ -332,7 +332,7 @@ PRInt32 native_thread = 0;
break;
}
if (native_thread) {
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
pthread_t tid;
if (!pthread_create(&tid, NULL, (void * (*)(void *)) start, arg))
return((PRThread *) tid);

Просмотреть файл

@ -13,7 +13,7 @@
#include <windows.h>
#include <process.h>
#endif
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
#include <pthread.h>
#endif
#ifdef SYMBIAN
@ -104,7 +104,7 @@ PRInt32 native_thread = 0;
PR_ASSERT(state == PR_UNJOINABLE_THREAD);
#if (defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)) || defined(WIN32) || defined(XP_OS2)
#if defined(_PR_PTHREADS) || defined(WIN32) || defined(XP_OS2)
switch(index % 4) {
case 0:
@ -124,7 +124,7 @@ PRInt32 native_thread = 0;
break;
}
if (native_thread) {
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
pthread_t tid;
if (!pthread_create(&tid, NULL, start, arg))
return((PRThread *) tid);

Просмотреть файл

@ -21,7 +21,7 @@
#ifdef XP_UNIX
#include <sys/mman.h>
#endif
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
#include <pthread.h>
#endif

Просмотреть файл

@ -21,7 +21,7 @@
#ifdef XP_UNIX
#include <sys/mman.h>
#endif
#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#if defined(_PR_PTHREADS)
#include <pthread.h>
#endif