File: cthreads.h

package info (click to toggle)
rvm 1.13%2Bdebian-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,800 kB
  • ctags: 2,012
  • sloc: ansic: 20,307; sh: 8,996; makefile: 115
file content (115 lines) | stat: -rw-r--r-- 2,747 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* BLURB lgpl

                           Coda File System
                              Release 5

          Copyright (c) 1987-1999 Carnegie Mellon University
                  Additional copyrights listed below

This  code  is  distributed "AS IS" without warranty of any kind under
the  terms of the  GNU  Library General Public Licence  Version 2,  as
shown in the file LICENSE. The technical and financial contributors to
Coda are listed in the file CREDITS.

                        Additional copyrights
                           none currently

#*/

/* dummy version of
 *
 * Definitions for the C Threads package.
 * (originally contributed by James W. O'Toole Jr., MIT)
 */

#ifndef	_CTHREADS_
#define	_CTHREADS_ 1

/*
 * C Threads package initialization.
 */

#define cthread_init()          {}      /* nop */

/*
 * Mutex objects.
 */
#ifdef sun
#define mutex ct_mutex
#endif
typedef struct mutex { int x; } *mutex_t;

#define	MUTEX_INITIALIZER	{0}

#define	mutex_init(m)		((m)->x = 0)
#define	mutex_clear(m)		/* nop */

#define	mutex_lock(m)		((m)->x = 1)
#define mutex_try_lock(m)	((m)->x ? 0 : ((m)->x = 1))
#define mutex_wait_lock(m)	((m)->x = 1)
#define mutex_unlock(m)		((m)->x = 0)

/*
 * Condition variables.
 */
typedef struct condition { int x; } *condition_t;

#define	CONDITION_INITIALIZER		{0}

#define	condition_init(c)		{}
#define	condition_clear(c)		{}

#define	condition_signal(c) 		{}

#define	condition_broadcast(c)		{}

#define condition_wait(c,m)		{}

/*
 * Threads.
 */
typedef int cthread;

/* What should be type of cthread_t ?
 * In rvm_lwp.h, it is type (PROCESS)   (eq. to (struct lwp_pcb *)),  
 * In rvm_pthread.h, it is type (pthread_t *),
 * Here, I leave it untouch as type (int) but we may need to modify this
 * in future.  -- 3/18/97 Clement
 */
typedef long cthread_t;

#define cthread_fork(func, arg)		(cthread_t)NULL

#define cthread_join(t)			0

#define cthread_yield()			{}

#define cthread_exit(result)		exit(result)

#define cthread_self()	    	    	(cthread_t)NULL
/* Unsupported cthread calls */

#define	mutex_alloc()			BOGUSCODE
#define	mutex_set_name(m, x)		BOGUSCODE
#define	mutex_name(m)			BOGUSCODE
#define	mutex_free(m)			BOGUSCODE

#define	condition_alloc()		BOGUSCODE
#define	condition_set_name(c, x)	BOGUSCODE
#define	condition_name(c)		BOGUSCODE
#define	condition_free(c)		BOGUSCODE

#define cthread_detach()		BOGUSCODE
#define cthread_sp()			BOGUSCODE
#define	cthread_assoc(id, t)		BOGUSCODE
#define cthread_set_name		BOGUSCODE
#define cthread_name			BOGUSCODE
#define cthread_count()			BOGUSCODE
#define cthread_set_limit		BOGUSCODE
#define cthread_limit()			BOGUSCODE
#define	cthread_set_data(t, x)		BOGUSCODE
#define	cthread_data(t)			BOGUSCODE


#endif /* _CTHREADS_ */