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