"Fossies" - the Fresh Open Source Software Archive

Member "pidentd-3.0.19/src/cma_thr.h" (20 Jan 1999, 1839 Bytes) of package /linux/misc/old/pidentd-3.0.19.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "cma_thr.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2 ** cma_thr.h - Pthreads over DCE/CMA Threads sort-of-compatibility header
    3 **
    4 ** Copyright (c) 1997 Peter Eriksson <pen@lysator.liu.se>
    5 **
    6 ** This program is free software; you can redistribute it and/or
    7 ** modify it as you wish - as long as you don't claim that you wrote
    8 ** it.
    9 **
   10 ** This program is distributed in the hope that it will be useful,
   11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
   12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   13 */
   14 
   15 #ifndef PIDENTD_CMA_THR_H
   16 #define PIDENTD_CMA_THR_H
   17 
   18 #ifdef HAVE_PTHREAD_H
   19 #include <pthread.h>
   20 #else
   21 #include "hp_pthread.h"
   22 #endif
   23 
   24 #include <errno.h>
   25 
   26 #define pthread_mutex_init(mp,ap)   \
   27     pthread_mutex_init((mp), ((ap) ? *((pthread_mutexattr_t *) (ap)) : pthread_mutexattr_default))
   28 
   29 #if 0
   30 #define pthread_mutex_lock(mp)      pthread_mutex_lock(mp)
   31 #define pthread_mutex_unlock(mp)    pthread_mutex_unlock(mp)
   32 #define pthread_mutex_destroy(mp)   pthread_mutex_destroy(mp)
   33 #endif
   34      
   35 #define pthread_cond_init(cp,ap)    \
   36     pthread_cond_init((cp), ((ap) ? *((pthread_condattr_t *) (ap)) : pthread_condattr_default))
   37 
   38 
   39 #define pthread_cond_wait(cp,mp)    \
   40      (pthread_cond_wait(cp,mp) ? errno : 0)
   41 
   42 #define pthread_cond_timedwait(cp,mp,to)    \
   43      (pthread_cond_timedwait(cp,mp,to) ? errno : 0)
   44      
   45 #if 0
   46 #define pthread_cond_signal(cp)     pthread_cond_signal(cp)
   47 #define pthread_cond_destroy(cp)    pthread_cond_destroy(cp)
   48 #endif
   49 
   50 #define pthread_attr_t          int
   51 #define pthread_attr_init(ap)       (*(ap) = 0)
   52 
   53 #define PTHREAD_CREATE_DETACHED     1
   54 #define PTHREAD_CREATE_JOINABLE     0
   55 
   56 #define PTHREAD_ONCE_INIT       { 0 }
   57      
   58 #define pthread_attr_setdetachstate(ap,state)   ((*(ap)) = state)
   59      
   60 #define pthread_create(tidp,attrp,func,arg) \
   61         (pthread_create((tidp), pthread_attr_default, (func), (arg)), \
   62      (((attrp) && *((int *) attrp)) ? pthread_detach((tidp)) : 0))
   63 
   64 
   65 #endif