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);
38 * per proc and thread data
40 void **procdata(void);
43 * supplied by user instead of main.
44 * mainstacksize is size of stack allocated to run threadmain
46 void threadmain(int argc, char *argv[]);
47 extern int mainstacksize;
50 * channel communication
52 typedef struct Alt Alt;
53 typedef struct _Altarray _Altarray;
54 typedef struct Channel Channel;
93 /* [Edit .+1,./^$/ |cfn -h $PLAN9/src/libthread/channel.c] */
94 int chanalt(Alt *alts);
95 Channel* chancreate(int elemsize, int elemcnt);
96 void chanfree(Channel *c);
97 int chaninit(Channel *c, int elemsize, int elemcnt);
98 int channbrecv(Channel *c, void *v);
99 void* channbrecvp(Channel *c);
100 ulong channbrecvul(Channel *c);
101 int channbsend(Channel *c, void *v);
102 int channbsendp(Channel *c, void *v);
103 int channbsendul(Channel *c, ulong v);
104 int chanrecv(Channel *c, void *v);
105 void* chanrecvp(Channel *c);
106 ulong chanrecvul(Channel *c);
107 int chansend(Channel *c, void *v);
108 int chansendp(Channel *c, void *v);
109 int chansendul(Channel *c, ulong v);
110 void chansetname(Channel *c, char *fmt, ...);
113 #define nbrecv channbrecv
114 #define nbrecvp channbrecvp
115 #define nvrecvul channbrecvul
116 #define nbsend channbsend
117 #define nbsendp channbsendp
118 #define nbsendul channbsendul
119 #define recv chanrecv
120 #define recvp chanrecvp
121 #define recvul chanrecvul
122 #define send chansend
123 #define sendp chansendp
124 #define sendul chansendul
129 typedef struct Ref Ref;
140 * slave i/o processes
142 typedef struct Ioproc Ioproc;
144 /* [Edit .+1,/^$/ |cfn -h $PLAN9/src/libthread/io*.c] */
145 void closeioproc(Ioproc *io);
146 long iocall(Ioproc *io, long (*op)(va_list*), ...);
147 int ioclose(Ioproc *io, int fd);
148 int iodial(Ioproc *io, char *addr, char *local, char *dir, int *cdfp);
149 void iointerrupt(Ioproc *io);
150 int ioopen(Ioproc *io, char *path, int mode);
151 Ioproc* ioproc(void);
152 long ioread(Ioproc *io, int fd, void *a, long n);
153 int ioread9pmsg(Ioproc*, int, void*, int);
154 long ioreadn(Ioproc *io, int fd, void *a, long n);
155 int iorecvfd(Ioproc *, int);
156 int iosendfd(Ioproc*, int, int);
157 int iosleep(Ioproc *io, long n);
158 long iowrite(Ioproc *io, int fd, void *a, long n);
161 * exec external programs
163 void threadexec(Channel*, int[3], char*, char *[]);
164 void threadexecl(Channel*, int[3], char*, ...);
165 int threadspawn(int[3], char*, char*[]);
166 Channel* threadwaitchan(void);
168 #if defined(__cplusplus)
171 #endif /* _THREADH_ */