1 /*
2 ** no_thr.h - "Pthreads" for systems without working threads.
3 **
4 ** Copyright (c) 1997-2000 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 PLIB_NO_THR_H
16 #define PLIB_NO_THR_H
17 
18 #include <errno.h>
19 
20 #ifndef HAVE_PTHREAD_MUTEX_T
21 typedef int pthread_mutex_t;
22 typedef int pthread_cond_t;
23 typedef int pthread_attr_t;
24 typedef int pthread_t;
25 typedef struct { int f; } pthread_once_t;
26 #endif
27 
28 #define pthread_mutex_init(mp,ap)	(0)
29 #define pthread_mutex_lock(mp)		(0)
30 #define pthread_mutex_unlock(mp)	(0)
31 #define pthread_mutex_destroy(mp)	(0)
32 
33 #define pthread_cond_init(cp,ap)	(0)
34 #define pthread_cond_wait(cp,mp)	(0)
35 #define pthread_cond_signal(cp)		(0)
36 #define pthread_cond_broadcast(cp)	(0)
37 #define pthread_cond_destroy(cp)	(0)
38 
39 #define pthread_attr_init(ap)		(0)
40 
41 #define PTHREAD_CREATE_DETACHED		1
42 
43 #define PTHREAD_ONCE_INIT		{0}
44 #define pthread_once(ov,fun) \
45 	(*((int *)ov) && ((*((int *)ov) = 1), (fun()), 1))
46 
47 #define pthread_attr_setdetachstate(ap,state)	(0)
48 
49 
50 #define pthread_create(tidp,attrp,func,arg)	((*(func))(arg), 0)
51 
52 
53 #endif
54