change to use new thread library
This commit is contained in:
parent
9cb6f43045
commit
94235a8b4b
2 changed files with 12 additions and 4 deletions
|
|
@ -39,6 +39,8 @@ fsinit(int fd)
|
||||||
fs->mux.recv = _fsrecv;
|
fs->mux.recv = _fsrecv;
|
||||||
fs->mux.gettag = _fsgettag;
|
fs->mux.gettag = _fsgettag;
|
||||||
fs->mux.settag = _fssettag;
|
fs->mux.settag = _fssettag;
|
||||||
|
fs->iorecv = ioproc();
|
||||||
|
fs->iosend = ioproc();
|
||||||
muxinit(&fs->mux);
|
muxinit(&fs->mux);
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
@ -105,6 +107,8 @@ _fsdecref(Fsys *fs)
|
||||||
next = f->next;
|
next = f->next;
|
||||||
free(f);
|
free(f);
|
||||||
}
|
}
|
||||||
|
closeioproc(fs->iorecv);
|
||||||
|
closeioproc(fs->iosend);
|
||||||
free(fs);
|
free(fs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -267,7 +271,7 @@ _fssend(Mux *mux, void *pkt)
|
||||||
Fsys *fs;
|
Fsys *fs;
|
||||||
|
|
||||||
fs = mux->aux;
|
fs = mux->aux;
|
||||||
return threadwrite(fs->fd, pkt, GBIT32((uchar*)pkt));
|
return iowrite(fs->iosend, fs->fd, pkt, GBIT32((uchar*)pkt));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void*
|
static void*
|
||||||
|
|
@ -279,7 +283,7 @@ _fsrecv(Mux *mux)
|
||||||
Fsys *fs;
|
Fsys *fs;
|
||||||
|
|
||||||
fs = mux->aux;
|
fs = mux->aux;
|
||||||
n = threadreadn(fs->fd, buf, 4);
|
n = ioreadn(fs->iorecv, fs->fd, buf, 4);
|
||||||
if(n != 4)
|
if(n != 4)
|
||||||
return nil;
|
return nil;
|
||||||
n = GBIT32(buf);
|
n = GBIT32(buf);
|
||||||
|
|
@ -289,12 +293,12 @@ _fsrecv(Mux *mux)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
PBIT32(pkt, n);
|
PBIT32(pkt, n);
|
||||||
if(threadreadn(fs->fd, pkt+4, n-4) != n-4){
|
if(ioreadn(fs->iorecv, fs->fd, pkt+4, n-4) != n-4){
|
||||||
free(pkt);
|
free(pkt);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
if(pkt[4] == Ropenfd){
|
if(pkt[4] == Ropenfd){
|
||||||
if((nfd=threadrecvfd(fs->fd)) < 0){
|
if((nfd=iorecvfd(fs->iorecv, fs->fd)) < 0){
|
||||||
fprint(2, "recv fd error: %r\n");
|
fprint(2, "recv fd error: %r\n");
|
||||||
free(pkt);
|
free(pkt);
|
||||||
return nil;
|
return nil;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Copyright (C) 2003 Russ Cox, Massachusetts Institute of Technology */
|
/* Copyright (C) 2003 Russ Cox, Massachusetts Institute of Technology */
|
||||||
/* See COPYRIGHT */
|
/* See COPYRIGHT */
|
||||||
|
|
||||||
|
#include <thread.h>
|
||||||
|
|
||||||
typedef struct Queue Queue;
|
typedef struct Queue Queue;
|
||||||
Queue *_fsqalloc(void);
|
Queue *_fsqalloc(void);
|
||||||
int _fsqsend(Queue*, void*);
|
int _fsqsend(Queue*, void*);
|
||||||
|
|
@ -22,6 +24,8 @@ struct Fsys
|
||||||
Queue *rxq;
|
Queue *rxq;
|
||||||
Fid *freefid;
|
Fid *freefid;
|
||||||
int nextfid;
|
int nextfid;
|
||||||
|
Ioproc *iorecv;
|
||||||
|
Ioproc *iosend;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Fid
|
struct Fid
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue