pidentd  3.0.19
About: implementation of the RFC1413 identification server (more or less complete rewrite compared to version 2)
  Fossies Dox: pidentd-3.0.19.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

cma_thr.h
Go to the documentation of this file.
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
hp_pthread.h