reopen plumber, build mail
This commit is contained in:
parent
98df7c80d8
commit
ced6fd340e
2 changed files with 44 additions and 16 deletions
|
|
@ -21,32 +21,60 @@ Window* openfile(Text*, Expand*, int);
|
||||||
int nuntitled;
|
int nuntitled;
|
||||||
|
|
||||||
void
|
void
|
||||||
plumbproc(void *v)
|
plumbthread(void *v)
|
||||||
{
|
{
|
||||||
|
CFid *fid;
|
||||||
Plumbmsg *m;
|
Plumbmsg *m;
|
||||||
|
Timer *t;
|
||||||
|
|
||||||
USED(v);
|
USED(v);
|
||||||
threadsetname("plumbproc");
|
threadsetname("plumbproc");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Loop so that if plumber is restarted, acme need not be.
|
||||||
|
*/
|
||||||
|
for(;;){
|
||||||
|
/*
|
||||||
|
* Connect to plumber.
|
||||||
|
*/
|
||||||
|
plumbunmount();
|
||||||
|
while((fid = plumbopenfid("edit", OREAD|OCEXEC)) == nil){
|
||||||
|
t = timerstart(2000);
|
||||||
|
recv(t->c, nil);
|
||||||
|
timerstop(t);
|
||||||
|
}
|
||||||
|
plumbeditfid = fid;
|
||||||
|
plumbsendfid = plumbopenfid("send", OWRITE|OCEXEC);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Relay messages.
|
||||||
|
*/
|
||||||
for(;;){
|
for(;;){
|
||||||
m = plumbrecvfid(plumbeditfid);
|
m = plumbrecvfid(plumbeditfid);
|
||||||
if(m == nil)
|
if(m == nil)
|
||||||
threadexits(nil);
|
break;
|
||||||
sendp(cplumb, m);
|
sendp(cplumb, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lost connection.
|
||||||
|
*/
|
||||||
|
fid = plumbsendfid;
|
||||||
|
plumbsendfid = nil;
|
||||||
|
fsclose(fid);
|
||||||
|
|
||||||
|
fid = plumbeditfid;
|
||||||
|
plumbeditfid = nil;
|
||||||
|
fsclose(fid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
startplumbing(void)
|
startplumbing(void)
|
||||||
{
|
{
|
||||||
plumbeditfid = plumbopenfid("edit", OREAD|OCEXEC);
|
|
||||||
if(plumbeditfid == nil)
|
|
||||||
fprint(2, "acme: can't initialize plumber: %r\n");
|
|
||||||
else{
|
|
||||||
cplumb = chancreate(sizeof(Plumbmsg*), 0);
|
cplumb = chancreate(sizeof(Plumbmsg*), 0);
|
||||||
chansetname(cplumb, "cplumb");
|
chansetname(cplumb, "cplumb");
|
||||||
threadcreate(plumbproc, nil, STACK);
|
threadcreate(plumbthread, nil, STACK);
|
||||||
}
|
|
||||||
plumbsendfid = plumbopenfid("send", OWRITE|OCEXEC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<$PLAN9/src/mkhdr
|
<$PLAN9/src/mkhdr
|
||||||
|
|
||||||
TARG=acme
|
TARG=acme
|
||||||
# DIRS=mail
|
DIRS=mail
|
||||||
|
|
||||||
OFILES=\
|
OFILES=\
|
||||||
acme.$O\
|
acme.$O\
|
||||||
|
|
@ -30,6 +30,6 @@ HFILES=dat.h\
|
||||||
fns.h\
|
fns.h\
|
||||||
|
|
||||||
<$PLAN9/src/mkone
|
<$PLAN9/src/mkone
|
||||||
# <$PLAN9/src/mkdirs
|
<$PLAN9/src/mkdirs
|
||||||
|
|
||||||
edit.$O ecmd.$O elog.$O: edit.h
|
edit.$O ecmd.$O elog.$O: edit.h
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue