src/3rdparty/ptmalloc/sysdeps/sproc/malloc-machine.h
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /* Basic platform-independent macro definitions for mutexes,
       
     2    thread-specific data and parameters for malloc.
       
     3    SGI threads (sprocs) version.
       
     4    Copyright (C) 2004 Wolfram Gloger <wg@malloc.de>.
       
     5 
       
     6 Permission to use, copy, modify, distribute, and sell this software
       
     7 and its documentation for any purpose is hereby granted without fee,
       
     8 provided that (i) the above copyright notices and this permission
       
     9 notice appear in all copies of the software and related documentation,
       
    10 and (ii) the name of Wolfram Gloger may not be used in any advertising
       
    11 or publicity relating to the software.
       
    12 
       
    13 THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
       
    14 EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
       
    15 WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
       
    16 
       
    17 IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL,
       
    18 INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY
       
    19 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
       
    20 WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY
       
    21 OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
       
    22 PERFORMANCE OF THIS SOFTWARE.
       
    23 */
       
    24 
       
    25 #ifndef _SPROC_MALLOC_MACHINE_H
       
    26 #define _SPROC_MALLOC_MACHINE_H
       
    27 
       
    28 #include <sys/wait.h>
       
    29 #include <sys/types.h>
       
    30 #include <sys/prctl.h>
       
    31 #include <abi_mutex.h>
       
    32 
       
    33 typedef abilock_t mutex_t;
       
    34 
       
    35 #define MUTEX_INITIALIZER          { 0 }
       
    36 #define mutex_init(m)              init_lock(m)
       
    37 #define mutex_lock(m)              (spin_lock(m), 0)
       
    38 #define mutex_trylock(m)           acquire_lock(m)
       
    39 #define mutex_unlock(m)            release_lock(m)
       
    40 
       
    41 typedef int tsd_key_t;
       
    42 int tsd_key_next;
       
    43 #define tsd_key_create(key, destr) ((*key) = tsd_key_next++)
       
    44 #define tsd_setspecific(key, data) (((void **)(&PRDA->usr_prda))[key] = data)
       
    45 #define tsd_getspecific(key, vptr) (vptr = ((void **)(&PRDA->usr_prda))[key])
       
    46 
       
    47 #define thread_atfork(prepare, parent, child) do {} while(0)
       
    48 
       
    49 #include <sysdeps/generic/malloc-machine.h>
       
    50 
       
    51 #endif /* !defined(_SPROC_MALLOC_MACHINE_H) */