aboutsummaryrefslogtreecommitdiff
path: root/src/libmux/thread.c
blob: 1c643e06df7b6c94cd18d9b10dc112971f19b072 (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
/* Copyright (C) 2003 Russ Cox, Massachusetts Institute of Technology */
/* See COPYRIGHT */

#include <u.h>
#include <libc.h>
#include <thread.h>
#include <mux.h>

enum
{
	STACK = 32768
};

void
muxthreads(Mux *mux)
{
	proccreate(_muxrecvproc, mux, STACK);
	qlock(&mux->lk);
	while(!mux->writeq)
		rsleep(&mux->rpcfork);
	qunlock(&mux->lk);
	proccreate(_muxsendproc, mux, STACK);
	qlock(&mux->lk);
	while(!mux->writeq)
		rsleep(&mux->rpcfork);
	qunlock(&mux->lk);
}