added gentoo ebuilds
[libmixp.git] / libmixp / thread.c
blob5bd8ba365d006f50a78279f064ffaf46b3f78cc2
1 #include <unistd.h>
2 #include "mixp_local.h"
4 static MIXP_THREAD ixp_nothread;
5 MIXP_THREAD *mixp_thread = &ixp_nothread;
7 static char*
8 errbuf() {
9 static char errbuf[IXP_ERRMAX];
11 return errbuf;
14 static void
15 mvoid(MIXP_MUTEX *m) {
16 USED(m);
17 return;
20 static int
21 mtrue(MIXP_MUTEX *m) {
22 USED(m);
23 return 1;
26 static int
27 mfalse(MIXP_MUTEX *m) {
28 USED(m);
29 return 0;
32 static void
33 rwvoid(MIXP_RWLOCK *rw) {
34 USED(rw);
35 return;
38 static int
39 rwtrue(MIXP_RWLOCK *rw) {
40 USED(rw);
41 return 1;
44 static int
45 rwfalse(MIXP_RWLOCK *m) {
46 USED(m);
47 return 0;
50 static void
51 rvoid(MIXP_RENDEZ *r) {
52 USED(r);
53 return;
56 static int
57 rfalse(MIXP_RENDEZ *r) {
58 USED(r);
59 return 0;
62 static void
63 rsleep(MIXP_RENDEZ *r) {
64 USED(r);
65 ixp_eprint("rsleep called when not implemented\n");
68 static MIXP_THREAD ixp_nothread = {
69 /* RWLock */
70 .initrwlock = rwfalse,
71 .rlock = rwvoid,
72 .runlock = rwvoid,
73 .canrlock = rwtrue,
74 .wlock = rwvoid,
75 .wunlock = rwvoid,
76 .canwlock = rwtrue,
77 .rwdestroy = rwvoid,
78 /* Mutex */
79 .initmutex = mfalse,
80 .lock = mvoid,
81 .unlock = mvoid,
82 .canlock = mtrue,
83 .mdestroy = mvoid,
84 /* Rendez */
85 .initrendez = rfalse,
86 .sleep = rsleep,
87 .wake = rfalse,
88 .wakeall = rfalse,
89 .rdestroy = rvoid,
90 /* Other */
91 .errbuf = errbuf,
92 .read = read,
93 .write = write,