VirtualBox

Changeset 102240 in vbox


Ignore:
Timestamp:
Nov 22, 2023 10:21:58 AM (12 months ago)
Author:
vboxsync
Message:

libs/xpcom: Move all pthreads related stuff into the last remaining file, bugref:10545

Location:
trunk/src/libs/xpcom18a4
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/Makefile.kmk

    r102239 r102240  
    178178NSPRPUB-MD-HEADERS_IFFLAGS = -m 644
    179179NSPRPUB-MD-HEADERS_SOURCES = \
    180         nsprpub/pr/include/md/_pth.h \
    181180        nsprpub/pr/include/md/prosdep.h
    182181
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/prosdep.h

    r102239 r102240  
    6767#endif
    6868
    69 
    70 #include "md/_pth.h"
    71 
    7269PR_END_EXTERN_C
    7370
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c

    r102232 r102240  
    5050#include <iprt/asm.h>
    5151#include <iprt/assert.h>
     52
     53/*
     54** Appropriate definitions of entry points not used in a pthreads world
     55*/
     56#define _PT_PTHREAD_MUTEXATTR_INIT        pthread_mutexattr_init
     57#define _PT_PTHREAD_MUTEX_INIT(m, a)      pthread_mutex_init(&(m), &(a))
     58#define _PT_PTHREAD_MUTEX_IS_LOCKED(m)    (EBUSY == pthread_mutex_trylock(&(m)))
     59#if defined(DARWIN)
     60#define _PT_PTHREAD_CONDATTR_INIT(x)      0
     61#else
     62#define _PT_PTHREAD_CONDATTR_INIT         pthread_condattr_init
     63#endif
     64#define _PT_PTHREAD_COND_INIT(m, a)       pthread_cond_init(&(m), &(a))
     65
     66/* The pthreads standard does not specify an invalid value for the
     67 * pthread_t handle.  (0 is usually an invalid pthread identifier
     68 * but there are exceptions, for example, DG/UX.)  These macros
     69 * define a way to set the handle to or compare the handle with an
     70 * invalid identifier.  These macros are not portable and may be
     71 * more of a problem as we adapt to more pthreads implementations.
     72 * They are only used in the PRMonitor functions.  Do not use them
     73 * in new code.
     74 *
     75 * Unfortunately some of our clients depend on certain properties
     76 * of our PRMonitor implementation, preventing us from replacing
     77 * it by a portable implementation.
     78 * - High-performance servers like the fact that PR_EnterMonitor
     79 *   only calls PR_Lock and PR_ExitMonitor only calls PR_Unlock.
     80 *   (A portable implementation would use a PRLock and a PRCondVar
     81 *   to implement the recursive lock in a monitor and call both
     82 *   PR_Lock and PR_Unlock in PR_EnterMonitor and PR_ExitMonitor.)
     83 *   Unfortunately this forces us to read the monitor owner field
     84 *   without holding a lock.
     85 * - One way to make it safe to read the monitor owner field
     86 *   without holding a lock is to make that field a PRThread*
     87 *   (one should be able to read a pointer with a single machine
     88 *   instruction).  However, PR_GetCurrentThread calls calloc if
     89 *   it is called by a thread that was not created by NSPR.  The
     90 *   malloc tracing tools in the Mozilla client use PRMonitor for
     91 *   locking in their malloc, calloc, and free functions.  If
     92 *   PR_EnterMonitor calls any of these functions, infinite
     93 *   recursion ensues.
     94 */
     95#if defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
     96    || defined(HPUX) || defined(LINUX) || defined(FREEBSD) \
     97    || defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
     98    || defined(VMS) || defined(NTO) || defined(DARWIN) \
     99    || defined(UNIXWARE)
     100#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t)  (t) = 0
     101#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t)  (t) == 0
     102#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt)   (dt) = (st)
     103#else
     104#error "pthreads is not supported for this architecture"
     105#endif
    52106
    53107static pthread_mutexattr_t _pt_mattr;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette