tmleft.c,v

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

C,V
68
字号
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
@/* tmleft.c - tmleft */

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

/*------------------------------------------------------------------------
 *  tmleft -  how much time left for this timer?
 *------------------------------------------------------------------------
 */
int tmleft(port, msg)
int	port, msg;
{
	struct	tqent	*tq;
	int		timeleft = 0;

	if (tqhead == NULL)
		return 0;
	wait(tqmutex);
	for (tq = tqhead; tq != NULL; tq = tq->tq_next) {
		timeleft += tq->tq_timeleft;
		if (tq->tq_port == port && tq->tq_msg == msg) {
			signal(tqmutex);
			return timeleft;
		}
	}
	signal(tqmutex);
	return 0;
}
@


1.1
log
@Initial revision
@
text
@@

⌨️ 快捷键说明

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