File: copythread.h

package info (click to toggle)
tra 20020816-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 1,696 kB
  • ctags: 2,623
  • sloc: ansic: 22,519; makefile: 406; asm: 269
file content (48 lines) | stat: -rw-r--r-- 966 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
typedef struct Chan Chan;
typedef struct Ctxt Ctxt;
typedef struct Fdbuf Fdbuf;
typedef struct Fdmsg Fdmsg;
typedef struct Thread Thread;

struct Ctxt
{
	Label label;	/* label should be (d)word aligned */
	void *stk;
};

struct Fdbuf
{
	Lock lk;
	int fd;
	int dead;
	Fdmsg *m;
	Fdmsg **em;
	Thread *t;
};

Chan*	_chan(int);
#define	chan(T)	_chan(sizeof(*(T*)0))
void		closefdbuf(Fdbuf*);
void	gotolabel(Label*);
Fdbuf*	openfdbuf(int);
void	_fdbufwatch(Fdbuf*);
void		initctxt(Ctxt*, void(*)(void*), void*);
int		readfdbuf(Fdbuf*, void*, int);
int		readnfdbuf(Fdbuf*, void*, int);
void		recv(Chan*, void*);
void*	recvp(Chan*);
ulong	recvul(Chan*);
void		send(Chan*, void*);
void		sendp(Chan*, void*);
void		sendul(Chan*, ulong);
int	setlabel(Label*);
void		threadcreate(void(*)(void*), void*);
void**	threaddata(void);
void		threadexit(void);
void		threadready(Thread*);
void		threadsleep(void);
void		yield(void);

extern	Thread*	curthread;
extern	Label	mainlabel;