Coda Distributed File System
cthreads.h
Go to the documentation of this file.
1/* BLURB lgpl
2
3 Coda File System
4 Release 8
5
6 Copyright (c) 1987-2025 Carnegie Mellon University
7 Additional copyrights listed below
8
9This code is distributed "AS IS" without warranty of any kind under
10the terms of the GNU Library General Public Licence Version 2, as
11shown in the file LICENSE. The technical and financial contributors to
12Coda 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() \
33 { \
34 } /* nop */
35
36#define cthread_uninit(retval) \
37 { \
38 } /* nop */
39
40/*
41 * Mutex objects.
42 */
43#ifdef sun
44#define mutex ct_mutex
45#endif
46typedef struct mutex {
47 int x;
49
50#define MUTEX_INITIALIZER { 0 }
51
52#define mutex_init(m) ((m)->x = 0)
53#define mutex_clear(m) /* nop */
54
55#define mutex_lock(m) ((m)->x = 1)
56#define mutex_try_lock(m) ((m)->x ? 0 : ((m)->x = 1))
57#define mutex_wait_lock(m) ((m)->x = 1)
58#define mutex_unlock(m) ((m)->x = 0)
59
60/*
61 * Condition variables.
62 */
63typedef struct condition {
64 int x;
66
67#define CONDITION_INITIALIZER { 0 }
68
69#define condition_init(c) \
70 { \
71 }
72#define condition_clear(c) \
73 { \
74 }
75
76#define condition_signal(c) \
77 { \
78 }
79
80#define condition_broadcast(c) \
81 { \
82 }
83
84#define condition_wait(c, m) \
85 { \
86 }
87
88/*
89 * Threads.
90 */
91typedef int cthread;
92
93/* What should be type of cthread_t ?
94 * In rvm_lwp.h, it is type (PROCESS) (eq. to (struct lwp_pcb *)),
95 * In rvm_pthread.h, it is type (pthread_t *),
96 * Here, I leave it untouch as type (int) but we may need to modify this
97 * in future. -- 3/18/97 Clement
98 */
99typedef long cthread_t;
100
101#define cthread_fork(func, arg) (cthread_t) NULL
102
103#define cthread_join(t) 0
104
105#define cthread_yield() \
106 { \
107 }
108
109#define cthread_exit(result) exit(result)
110
111#define cthread_self() (cthread_t) NULL
112/* Unsupported cthread calls */
113
114#define mutex_alloc() BOGUSCODE
115#define mutex_set_name(m, x) BOGUSCODE
116#define mutex_name(m) BOGUSCODE
117#define mutex_free(m) BOGUSCODE
118
119#define condition_alloc() BOGUSCODE
120#define condition_set_name(c, x) BOGUSCODE
121#define condition_name(c) BOGUSCODE
122#define condition_free(c) BOGUSCODE
123
124#define cthread_detach() BOGUSCODE
125#define cthread_sp() BOGUSCODE
126#define cthread_assoc(id, t) BOGUSCODE
127#define cthread_set_name BOGUSCODE
128#define cthread_name BOGUSCODE
129#define cthread_count() BOGUSCODE
130#define cthread_set_limit BOGUSCODE
131#define cthread_limit() BOGUSCODE
132#define cthread_set_data(t, x) BOGUSCODE
133#define cthread_data(t) BOGUSCODE
134
135#endif /* _CTHREADS_ */
long cthread_t
Definition: cthreads.h:99
struct condition * condition_t
int cthread
Definition: cthreads.h:91
struct mutex * mutex_t
Definition: cthreads.h:63
int x
Definition: cthreads.h:64
Definition: cthreads.h:46
int x
Definition: cthreads.h:47