3 #if defined(__cplusplus)
8 * basic procs and threads
10 int proccreate(void (*f)(void *arg), void *arg, unsigned int stacksize);
11 int threadcreate(void (*f)(void *arg), void *arg, unsigned int stacksize);
12 void threadexits(char *);
13 void threadexitsall(char *);
14 void threadsetname(char*, ...);
15 void threadsetstate(char*, ...);
16 void threadyield(void);
17 void _threadready(_Thread*);
18 void _threadswitch(void);
19 void _threadsetsysproc(void);
20 void _threadsleep(Rendez*);
21 _Thread *_threadwakeup(Rendez*);
22 #define yield threadyield
25 * per proc and thread data
27 void **procdata(void);
30 * supplied by user instead of main.
31 * mainstacksize is size of stack allocated to run threadmain
33 void threadmain(int argc, char *argv[]);
34 extern int mainstacksize;
37 * channel communication
39 typedef struct Alt Alt;
40 typedef struct _Altarray _Altarray;
41 typedef struct Channel Channel;
80 /* [Edit .+1,./^$/ |cfn -h $PLAN9/src/libthread/channel.c] */
81 int chanalt(Alt *alts);
82 Channel* chancreate(int elemsize, int elemcnt);
83 void chanfree(Channel *c);
84 int chaninit(Channel *c, int elemsize, int elemcnt);
85 int channbrecv(Channel *c, void *v);
86 void* channbrecvp(Channel *c);
87 ulong channbrecvul(Channel *c);
88 int channbsend(Channel *c, void *v);
89 int channbsendp(Channel *c, void *v);
90 int channbsendul(Channel *c, ulong v);
91 int chanrecv(Channel *c, void *v);
92 void* chanrecvp(Channel *c);
93 ulong chanrecvul(Channel *c);
94 int chansend(Channel *c, void *v);
95 int chansendp(Channel *c, void *v);
96 int chansendul(Channel *c, ulong v);
99 #define nbrecv channbrecv
100 #define nbrecvp channbrecvp
101 #define nvrecvul channbrecvul
102 #define nbsend channbsend
103 #define nbsendp channbsendp
104 #define nbsendul channbsendul
105 #define recv chanrecv
106 #define recvp chanrecvp
107 #define recvul chanrecvul
108 #define send chansend
109 #define sendp chansendp
110 #define sendul chansendul
115 typedef struct Ref Ref;
126 * slave i/o processes
128 typedef struct Ioproc Ioproc;
130 /* [Edit .+1,/^$/ |cfn -h $PLAN9/src/libthread/io*.c] */
131 void closeioproc(Ioproc *io);
132 long iocall(Ioproc *io, long (*op)(va_list*), ...);
133 int ioclose(Ioproc *io, int fd);
134 int iodial(Ioproc *io, char *addr, char *local, char *dir, int *cdfp);
135 void iointerrupt(Ioproc *io);
136 int ioopen(Ioproc *io, char *path, int mode);
137 Ioproc* ioproc(void);
138 long ioread(Ioproc *io, int fd, void *a, long n);
139 int ioread9pmsg(Ioproc*, int, void*, int);
140 long ioreadn(Ioproc *io, int fd, void *a, long n);
141 int iorecvfd(Ioproc *, int);
142 int iosendfd(Ioproc*, int, int);
143 int iosleep(Ioproc *io, long n);
144 long iowrite(Ioproc *io, int fd, void *a, long n);
147 * exec external programs
149 void threadexec(Channel*, int[3], char*, char *[]);
150 void threadexecl(Channel*, int[3], char*, ...);
151 int threadspawn(int[3], char*, char*[]);
152 Channel* threadwaitchan(void);
154 #if defined(__cplusplus)
157 #endif /* _THREADH_ */