"Fossies" - the Fresh Open Source Software Archive

Member "pidentd-3.0.19/src/no_thr.h" (2 Aug 1999, 1646 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 "no_thr.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2 ** no_thr.h - "Pthreads" for systems without working threads.
    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_NO_THR_H
   16 #define PIDENTD_NO_THR_H
   17 
   18 #include <sys/types.h>
   19 #include <errno.h>
   20 
   21 #ifdef _POSIX_SOURCE
   22 #define THREAD_TYPE_DEFINED
   23 #endif
   24 
   25 #ifndef THREAD_TYPE_DEFINED
   26 #define pthread_mutex_t         int
   27 #endif
   28 
   29 #define pthread_mutex_init(mp,ap)   (*(mp) = 0)
   30 #define pthread_mutex_lock(mp)      (*(mp) = 1)
   31 #define pthread_mutex_unlock(mp)    (*(mp) = 0)
   32 #define pthread_mutex_destroy(mp)   (0)
   33 
   34 #ifndef THREAD_TYPE_DEFINED
   35 #define pthread_cond_t          int
   36 #endif
   37 
   38 #define pthread_cond_init(cp,ap)    (*(cp) = 0)
   39 #define pthread_cond_wait(cp,mp)    (0)
   40 #define pthread_cond_signal(cp)     (*(cp) = 1)
   41 #define pthread_cond_broadcast(cp)  (*(cp) = 1)
   42 #define pthread_cond_destroy(cp)    (0)
   43 
   44 #ifndef THREAD_TYPE_DEFINED
   45 #define pthread_attr_t          int
   46 #endif
   47 
   48 #define pthread_attr_init(ap)       (*(ap) = 0)
   49 
   50 #ifndef THREAD_TYPE_DEFINED
   51 #define pthread_t           int
   52 #endif
   53 
   54 #define PTHREAD_CREATE_DETACHED     1
   55 
   56 #ifndef THREAD_TYPE_DEFINED
   57 #define pthread_once_t          int
   58 #endif
   59 
   60 #define PTHREAD_ONCE_INIT       0
   61 #define pthread_once(ov,fun)        (*(ov) && ((*(ov) = 1), (fun()), 1))
   62 
   63 #define pthread_attr_setdetachstate(ap,state)   ((*ap) = state)
   64      
   65 #define pthread_create(tidp,attrp,func,arg) ((*(func))(arg), 0)
   66         
   67 #endif