3 #if defined(__cplusplus)
10 * basic procs and threads
12 int proccreate(void (*f)(void *arg), void *arg, unsigned int stacksize);
13 int threadcreate(void (*f)(void *arg), void *arg, unsigned int stacksize);
14 void threadexits(char *);
15 void threadexitsall(char *);
16 void threadsetname(char*, ...);
17 void threadsetstate(char*, ...);
18 int threadyield(void);
19 void _threadready(_Thread*);
20 void _threadswitch(void);
21 void _threadsetsysproc(void);
22 void _threadsleep(Rendez*);
23 _Thread *_threadwakeup(Rendez*);
24 #define yield threadyield
29 void threadnotify(int(*f)(void*,char*), int);
34 void threaddaemonize(void);
40 void threadlinklibrary(void);
43 * per proc and thread data
45 void **procdata(void);
48 * supplied by user instead of main.
49 * mainstacksize is size of stack allocated to run threadmain
51 void threadmain(int argc, char *argv[]);
52 extern int mainstacksize;
55 * channel communication
57 typedef struct Alt Alt;
58 typedef struct _Altarray _Altarray;
59 typedef struct Channel Channel;
98 /* [Edit .+1,./^$/ |cfn -h $PLAN9/src/libthread/channel.c] */
99 int chanalt(Alt *alts);
100 Channel* chancreate(int elemsize, int elemcnt);
101 void chanfree(Channel *c);
102 int chaninit(Channel *c, int elemsize, int elemcnt);
103 int channbrecv(Channel *c, void *v);
104 void* channbrecvp(Channel *c);
105 ulong channbrecvul(Channel *c);
106 int channbsend(Channel *c, void *v);
107 int channbsendp(Channel *c, void *v);
108 int channbsendul(Channel *c, ulong v);
109 int chanrecv(Channel *c, void *v);
110 void* chanrecvp(Channel *c);
111 ulong chanrecvul(Channel *c);
112 int chansend(Channel *c, void *v);
113 int chansendp(Channel *c, void *v);
114 int chansendul(Channel *c, ulong v);
115 void chansetname(Channel *c, char *fmt, ...);
118 #define nbrecv channbrecv
119 #define nbrecvp channbrecvp
120 #define nvrecvul channbrecvul
121 #define nbsend channbsend
122 #define nbsendp channbsendp
123 #define nbsendul channbsendul
124 #define recv chanrecv
125 #define recvp chanrecvp
126 #define recvul chanrecvul
127 #define send chansend
128 #define sendp chansendp
129 #define sendul chansendul
134 typedef struct Ref Ref;
145 * slave i/o processes
147 typedef struct Ioproc Ioproc;
149 /* [Edit .+1,/^$/ |cfn -h $PLAN9/src/libthread/io*.c] */
150 void closeioproc(Ioproc *io);
151 long iocall(Ioproc *io, long (*op)(va_list*), ...);
152 int ioclose(Ioproc *io, int fd);
153 int iodial(Ioproc *io, char *addr, char *local, char *dir, int *cdfp);
154 void iointerrupt(Ioproc *io);
155 int ioopen(Ioproc *io, char *path, int mode);
156 Ioproc* ioproc(void);
157 long ioread(Ioproc *io, int fd, void *a, long n);
158 int ioread9pmsg(Ioproc*, int, void*, int);
159 long ioreadn(Ioproc *io, int fd, void *a, long n);
160 int iorecvfd(Ioproc *, int);
161 int iosendfd(Ioproc*, int, int);
162 int iosleep(Ioproc *io, long n);
163 long iowrite(Ioproc *io, int fd, void *a, long n);
166 * exec external programs
168 void threadexec(Channel*, int[3], char*, char *[]);
169 void threadexecl(Channel*, int[3], char*, ...);
170 int threadspawn(int[3], char*, char*[]);
171 Channel* threadwaitchan(void);
173 #if defined(__cplusplus)
176 #endif /* _THREADH_ */