tcpwakeup.c,v

来自「TCP-IP红宝书源代码」· C,V 代码 · 共 80 行

C,V
80
字号
head	1.2;
access;
symbols;
locks
	dls:1.2; strict;
comment	@ * @;


1.2
date	97.09.21.19.29.52;	author dls;	state Dist;
branches;
next	1.1;

1.1
date	94.01.14.03.51.20;	author dls;	state v2e1;
branches;
next	;


desc
@@


1.2
log
@pre-3e code
@
text
@/* tcpwakeup.c - tcpwakeup */

#include <conf.h>
#include <kernel.h>
#include <network.h>

/*------------------------------------------------------------------------
 *  tcpwakeup -  wake up processes sleeping for TCP, if necessary
 *	NB: Called with tcb_mutex HELD
 *------------------------------------------------------------------------
 */
int tcpwakeup(type, ptcb)
int		type;
struct	tcb	*ptcb;
{
	int		freelen;
	STATWORD	ps;
	disable(ps);
	if (type & READERS) {
		if (((ptcb->tcb_flags & TCBF_RDONE) ||
		    ptcb->tcb_rbcount > 0 ||
		    (ptcb->tcb_flags & TCBF_RUPOK)) &&
		    scount(ptcb->tcb_rsema) <= 0)
			signal(ptcb->tcb_rsema);
	}
	if (type & WRITERS) {
		freelen = ptcb->tcb_sbsize - ptcb->tcb_sbcount;
		if (((ptcb->tcb_flags & TCBF_SDONE) || freelen > 0) &&
		    scount(ptcb->tcb_ssema) <= 0)
			signal(ptcb->tcb_ssema);
		/* special for abort */
		if (ptcb->tcb_error && ptcb->tcb_ocsem > 0)
			signal(ptcb->tcb_ocsem);
	}
	restore(ps);
	return OK;
}
@


1.1
log
@Initial revision
@
text
@a15 1

d21 2
a22 1
		    ptcb->tcb_rbcount > 0 || ptcb->tcb_rudq >= 0) &&
@

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?