plan 9 kernel history: overview | file list | diff list

1990/0403/gnot/stream.c (diff list | history)

1990/0331/sys/src/9/gnot/stream.c:145,1541990/0403/sys/src/9/gnot/stream.c:145,153 (short | long | prev | next)
1990/03091    
	lock(bcp); 
	while(bcp->first == 0){ 
		unlock(bcp); 
1990/0331    
		if(loop++ > 10){ 
1990/0403    
		if(loop++ == 10){ 
1990/0331    
			dumpqueues(); 
			dumpstack(); 
1990/0322    
			panic("waiting for blocks\n"); 
1990/0403    
			print("waiting for blocks\n"); 
1990/0331    
		} 
1990/0312    
		qlock(bcp); 
1990/0322    
		tsleep(&bcp->r, isblock, (void *)bcp, 250); 
1990/0331/sys/src/9/gnot/stream.c:230,2351990/0403/sys/src/9/gnot/stream.c:229,235
1990/03091    
	q->r.p = 0; 
	q->info = qi; 
	q->put = qi->iput; 
1990/0403    
	q->len = q->nb = 0; 
1990/03091    
	wq = q->other = q + 1; 
 
	wq->r.p = 0; 
1990/0331/sys/src/9/gnot/stream.c:236,2411990/0403/sys/src/9/gnot/stream.c:236,242
1990/03091    
	wq->info = qi; 
	wq->put = qi->oput; 
	wq->other = q; 
1990/0403    
	wq->len = wq->nb = 0; 
1990/03091    
 
	unlock(q); 
 
1990/0331/sys/src/9/gnot/stream.c:323,3361990/0403/sys/src/9/gnot/stream.c:324,339
1990/03091    
	else 
		q->first = bp; 
1990/0312    
	q->len += BLEN(bp); 
1990/0403    
	q->nb++; 
1990/03091    
	delim = bp->flags & S_DELIM; 
	while(bp->next) { 
		bp = bp->next; 
1990/0312    
		q->len += BLEN(bp); 
1990/0403    
		q->nb++; 
1990/03091    
		delim |= bp->flags & S_DELIM; 
	} 
	q->last = bp; 
	if(q->len >= Streamhi) 
1990/0403    
	if(q->len >= Streamhi || q->nb >= Streambhi) 
1990/03091    
		q->flag |= QHIWAT; 
	unlock(q); 
	return delim; 
1990/0331/sys/src/9/gnot/stream.c:387,3931990/0403/sys/src/9/gnot/stream.c:390,397
1990/03091    
		if(q->first == 0) 
			q->last = 0; 
1990/0312    
		q->len -= BLEN(bp); 
1990/03091    
		if((q->flag&QHIWAT) && q->len < Streamhi/2){ 
1990/0403    
		q->nb--; 
		if((q->flag&QHIWAT) && q->len < Streamhi/2 && q->nb < Streambhi){ 
1990/03091    
			wakeup(&q->other->next->other->r); 
			q->flag &= ~QHIWAT; 
		} 
1990/0331/sys/src/9/gnot/stream.c:762,7751990/0403/sys/src/9/gnot/stream.c:766,781
1990/03091    
		else 
			q->first = bp; 
1990/0312    
		q->len += BLEN(bp); 
1990/0403    
		q->nb++; 
1990/0321    
		delim = bp->flags & S_DELIM; 
1990/0312    
		while(bp->next) { 
			bp = bp->next; 
			q->len += BLEN(bp); 
1990/0403    
			q->nb++; 
1990/0321    
			delim |= bp->flags & S_DELIM; 
1990/0312    
		} 
1990/03091    
		q->last = bp; 
1990/0321    
		if(q->len >= Streamhi){ 
1990/0403    
		if(q->len >= Streamhi || q->nb >= Streambhi){ 
1990/03091    
			q->flag |= QHIWAT; 
1990/0321    
			delim = 1; 
		} 
1990/0331/sys/src/9/gnot/stream.c:938,9501990/0403/sys/src/9/gnot/stream.c:944,955
1990/03091    
	Queue *q; 
 
	q = (Queue *)arg; 
	return q->len < Streamhi; 
1990/0403    
	return !QFULL(q->next); 
1990/03091    
} 
void 
flowctl(Queue *q) 
{ 
	if(q->next->len >= Streamhi) 
		sleep(&q->r, notfull, q->next); 
1990/0403    
	sleep(&q->r, notfull, q->next); 
1990/03091    
} 
 
/* 
1990/0331/sys/src/9/gnot/stream.c:996,10021990/0403/sys/src/9/gnot/stream.c:1001,1007
1990/03091    
		 *  `a' is global to the whole system, just create a 
		 *  pointer to it and pass it on. 
		 */ 
		flowctl(q); 
1990/0403    
		FLOWCTL(q); 
1990/03091    
		bp = allocb(0); 
		bp->rptr = bp->base = (uchar *)a; 
		bp->wptr = bp->lim = (uchar *)a+n; 
1990/0331/sys/src/9/gnot/stream.c:1009,10151990/0403/sys/src/9/gnot/stream.c:1014,1020
1990/03091    
		 *  system buffers and pass the buffers on. 
		 */ 
		for(rem = n; ; rem -= i) { 
			flowctl(q); 
1990/0403    
			FLOWCTL(q); 
1990/03091    
			bp = allocb(rem); 
			i = bp->lim - bp->wptr; 
			if(i >= rem){ 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)