aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/tsignal.c
blob: 9c64c46bd39eb5ee3d1dfe5dc8c9fc5d58742cdb (plain)
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
#include <u.h>
#include <libc.h>
#include <thread.h>

extern int _threaddebuglevel;

void
usage(void)
{
	fprint(2, "usage: tsignal [-[ednf] note]*\n");
	threadexitsall("usage");
}

void
threadmain(int argc, char **argv)
{
	Channel *c;
	char *msg;

	ARGBEGIN{
	case 'D':
		_threaddebuglevel = ~0;
		break;
	default:
		usage();
	case 'e':
		notifyenable(EARGF(usage()));
		break;
	case 'd':
		notifydisable(EARGF(usage()));
		break;
	case 'n':
		notifyon(EARGF(usage()));
		break;
	case 'f':
		notifyoff(EARGF(usage()));
		break;
	}ARGEND

	c = threadnotechan();
	while((msg = recvp(c)) != nil)
		print("note: %s\n", msg);
}