summaryrefslogtreecommitdiff
path: root/emu/port/qio.c
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2008-01-16 13:53:02 +0000
committerCharles.Forsyth <devnull@localhost>2008-01-16 13:53:02 +0000
commit85cef7b8460d7280ed0d574689ca8b0d38b21721 (patch)
tree33f1f9a17c89bb9ce89b91c2589b987353564609 /emu/port/qio.c
parente3aab25739d35e74577b3a97fe435396435d1088 (diff)
20080116-1359
Diffstat (limited to 'emu/port/qio.c')
-rw-r--r--emu/port/qio.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/emu/port/qio.c b/emu/port/qio.c
index 1dfa5d32..b900dff3 100644
--- a/emu/port/qio.c
+++ b/emu/port/qio.c
@@ -24,6 +24,7 @@ struct Queue
int eof; /* number of eofs read by user */
void (*kick)(void*); /* restart output */
+ void (*bypass)(void*, Block*); /* bypass queue altogether */
void* arg; /* argument to kick */
QLock rlock; /* mutex for reading processes */
@@ -846,6 +847,24 @@ qopen(int limit, int msg, void (*kick)(void*), void *arg)
return q;
}
+/* open a queue to be bypassed */
+Queue*
+qbypass(void (*bypass)(void*, Block*), void *arg)
+{
+ Queue *q;
+
+ q = malloc(sizeof(Queue));
+ if(q == 0)
+ return 0;
+
+ q->limit = 0;
+ q->arg = arg;
+ q->bypass = bypass;
+ q->state = 0;
+
+ return q;
+}
+
static int
notempty(void *a)
{
@@ -1179,6 +1198,10 @@ qbwrite(Queue *q, Block *b)
dowakeup = 0;
n = BLEN(b);
+ if(q->bypass){
+ (*q->bypass)(q->arg, b);
+ return n;
+ }
cb.b = b;
qlock(&q->wlock);