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 _threadready(_Thread*);
17 void _threadswitch(void);
18 void _threadsetsysproc(void);
19 void _threadsleep(Rendez*);
20 _Thread *_threadwakeup(Rendez*);
23 * per proc and thread data
25 void **procdata(void);
28 * supplied by user instead of main.
29 * mainstacksize is size of stack allocated to run threadmain
31 void threadmain(int argc, char *argv[]);
32 extern int mainstacksize;
35 * channel communication
37 typedef struct Alt Alt;
38 typedef struct _Altarray _Altarray;
39 typedef struct Channel Channel;
78 /* [Edit .+1,./^$/ |cfn -h $PLAN9/src/libthread/channel.c] */
79 int chanalt(Alt *alts);
80 Channel* chancreate(int elemsize, int elemcnt);
81 void chanfree(Channel *c);
82 int chaninit(Channel *c, int elemsize, int elemcnt);
83 int channbrecv(Channel *c, void *v);
84 void* channbrecvp(Channel *c);
85 ulong channbrecvul(Channel *c);
86 int channbsend(Channel *c, void *v);
87 int channbsendp(Channel *c, void *v);
88 int channbsendul(Channel *c, ulong v);
89 int chanrecv(Channel *c, void *v);
90 void* chanrecvp(Channel *c);
91 ulong chanrecvul(Channel *c);
92 int chansend(Channel *c, void *v);
93 int chansendp(Channel *c, void *v);
94 int chansendul(Channel *c, ulong v);
97 #define nbrecv channbrecv
98 #define nbrecvp channbrecvp
99 #define nvrecvul channbrecvul
100 #define nbsend channbsend
101 #define nbsendp channbsendp
102 #define nbsendul channbsendul
103 #define recv chanrecv
104 #define recvp chanrecvp
105 #define recvul chanrecvul
106 #define send chansend
107 #define sendp chansendp
108 #define sendul chansendul
113 typedef struct Ref Ref;
124 * slave i/o processes
126 typedef struct Ioproc Ioproc;
128 /* [Edit .+1,/^$/ |cfn -h $PLAN9/src/libthread/io*.c] */
129 void closeioproc(Ioproc *io);
130 long iocall(Ioproc *io, long (*op)(va_list*), ...);
131 int ioclose(Ioproc *io, int fd);
132 int iodial(Ioproc *io, char *addr, char *local, char *dir, int *cdfp);
133 void iointerrupt(Ioproc *io);
134 int ioopen(Ioproc *io, char *path, int mode);
135 Ioproc* ioproc(void);
136 long ioread(Ioproc *io, int fd, void *a, long n);
137 int ioread9pmsg(Ioproc*, int, void*, int);
138 long ioreadn(Ioproc *io, int fd, void *a, long n);
139 int iorecvfd(Ioproc *, int);
140 int iosendfd(Ioproc*, int, int);
141 int iosleep(Ioproc *io, long n);
142 long iowrite(Ioproc *io, int fd, void *a, long n);
145 * exec external programs
147 void threadexec(Channel*, int[3], char*, char *[]);
148 void threadexecl(Channel*, int[3], char*, ...);
149 int threadspawn(int[3], char*, char*[]);
150 Channel* threadwaitchan(void);
152 #if defined(__cplusplus)
155 #endif /* _THREADH_ */