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
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);
97 void chansetname(Channel *c, char *fmt, ...);
100 #define nbrecv channbrecv
101 #define nbrecvp channbrecvp
102 #define nvrecvul channbrecvul
103 #define nbsend channbsend
104 #define nbsendp channbsendp
105 #define nbsendul channbsendul
106 #define recv chanrecv
107 #define recvp chanrecvp
108 #define recvul chanrecvul
109 #define send chansend
110 #define sendp chansendp
111 #define sendul chansendul
116 typedef struct Ref Ref;
127 * slave i/o processes
129 typedef struct Ioproc Ioproc;
131 /* [Edit .+1,/^$/ |cfn -h $PLAN9/src/libthread/io*.c] */
132 void closeioproc(Ioproc *io);
133 long iocall(Ioproc *io, long (*op)(va_list*), ...);
134 int ioclose(Ioproc *io, int fd);
135 int iodial(Ioproc *io, char *addr, char *local, char *dir, int *cdfp);
136 void iointerrupt(Ioproc *io);
137 int ioopen(Ioproc *io, char *path, int mode);
138 Ioproc* ioproc(void);
139 long ioread(Ioproc *io, int fd, void *a, long n);
140 int ioread9pmsg(Ioproc*, int, void*, int);
141 long ioreadn(Ioproc *io, int fd, void *a, long n);
142 int iorecvfd(Ioproc *, int);
143 int iosendfd(Ioproc*, int, int);
144 int iosleep(Ioproc *io, long n);
145 long iowrite(Ioproc *io, int fd, void *a, long n);
148 * exec external programs
150 void threadexec(Channel*, int[3], char*, char *[]);
151 void threadexecl(Channel*, int[3], char*, ...);
152 int threadspawn(int[3], char*, char*[]);
153 Channel* threadwaitchan(void);
155 #if defined(__cplusplus)
158 #endif /* _THREADH_ */