1 /* BLURB lgpl
2 
3                            Coda File System
4                               Release 5
5 
6           Copyright (c) 1987-1999 Carnegie Mellon University
7                   Additional copyrights listed below
8 
9 This  code  is  distributed "AS IS" without warranty of any kind under
10 the  terms of the  GNU  Library General Public Licence  Version 2,  as
11 shown in the file LICENSE. The technical and financial contributors to
12 Coda are listed in the file CREDITS.
13 
14                         Additional copyrights
15                            none currently
16 
17 #*/
18 
19 /* dummy version of
20  *
21  * Definitions for the C Threads package.
22  * (originally contributed by James W. O'Toole Jr., MIT)
23  */
24 
25 #ifndef	_CTHREADS_
26 #define	_CTHREADS_ 1
27 
28 /*
29  * C Threads package initialization.
30  */
31 
32 #define cthread_init()          {}      /* nop */
33 
34 /*
35  * Mutex objects.
36  */
37 #ifdef sun
38 #define mutex ct_mutex
39 #endif
40 typedef struct mutex { int x; } *mutex_t;
41 
42 #define	MUTEX_INITIALIZER	{0}
43 
44 #define	mutex_init(m)		((m)->x = 0)
45 #define	mutex_clear(m)		/* nop */
46 
47 #define	mutex_lock(m)		((m)->x = 1)
48 #define mutex_try_lock(m)	((m)->x ? 0 : ((m)->x = 1))
49 #define mutex_wait_lock(m)	((m)->x = 1)
50 #define mutex_unlock(m)		((m)->x = 0)
51 
52 /*
53  * Condition variables.
54  */
55 typedef struct condition { int x; } *condition_t;
56 
57 #define	CONDITION_INITIALIZER		{0}
58 
59 #define	condition_init(c)		{}
60 #define	condition_clear(c)		{}
61 
62 #define	condition_signal(c) 		{}
63 
64 #define	condition_broadcast(c)		{}
65 
66 #define condition_wait(c,m)		{}
67 
68 /*
69  * Threads.
70  */
71 typedef int cthread;
72 
73 /* What should be type of cthread_t ?
74  * In rvm_lwp.h, it is type (PROCESS)   (eq. to (struct lwp_pcb *)),
75  * In rvm_pthread.h, it is type (pthread_t *),
76  * Here, I leave it untouch as type (int) but we may need to modify this
77  * in future.  -- 3/18/97 Clement
78  */
79 typedef long cthread_t;
80 
81 #define cthread_fork(func, arg)		(cthread_t)NULL
82 
83 #define cthread_join(t)			0
84 
85 #define cthread_yield()			{}
86 
87 #define cthread_exit(result)		exit(result)
88 
89 #define cthread_self()	    	    	(cthread_t)NULL
90 /* Unsupported cthread calls */
91 
92 #define	mutex_alloc()			BOGUSCODE
93 #define	mutex_set_name(m, x)		BOGUSCODE
94 #define	mutex_name(m)			BOGUSCODE
95 #define	mutex_free(m)			BOGUSCODE
96 
97 #define	condition_alloc()		BOGUSCODE
98 #define	condition_set_name(c, x)	BOGUSCODE
99 #define	condition_name(c)		BOGUSCODE
100 #define	condition_free(c)		BOGUSCODE
101 
102 #define cthread_detach()		BOGUSCODE
103 #define cthread_sp()			BOGUSCODE
104 #define	cthread_assoc(id, t)		BOGUSCODE
105 #define cthread_set_name		BOGUSCODE
106 #define cthread_name			BOGUSCODE
107 #define cthread_count()			BOGUSCODE
108 #define cthread_set_limit		BOGUSCODE
109 #define cthread_limit()			BOGUSCODE
110 #define	cthread_set_data(t, x)		BOGUSCODE
111 #define	cthread_data(t)			BOGUSCODE
112 
113 
114 #endif /* _CTHREADS_ */
115 
116