Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/pc/cycintr.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname pc/cycintr.c 2000/0623
## diff -e /dev/null /n/emeliedump/2000/0623/sys/src/9/pc/cycintr.c
0a
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "io.h"


static struct
{
	Lock;
	vlong	when;			/* next scheduled interrupt time */
	Cycintr	*ci;
}cycintrs;

static void
cycsched(void)
{
}

void
checkcycintr(Ureg *u, void*)
{
	Cycintr *ci;

	ilock(&cycintrs);
	while(ci = cycintrs.ci){
		if(ci->when > fastticks(nil))
			break;
		cycintrs.ci = ci->next;
		iunlock(&cycintrs);
		(*ci->f)(u, ci);
		ilock(&cycintrs);
	}
	cycsched();
	iunlock(&cycintrs);
}

void
cycintradd(Cycintr *nci)
{
	Cycintr *ci, **last;

	ilock(&cycintrs);
	last = &cycintrs.ci;
	while(ci = *last){
		if(ci == nci){
			*last = ci->next;
			break;
		}
		last = &ci->next;
	}

	last = &cycintrs.ci;
	while(ci = *last){
		if(ci->when > nci->when)
			break;
		last = &ci->next;
	}
	nci->next = *last;
	*last = nci;
	if(nci->when < cycintrs.when)
		cycsched();
	iunlock(&cycintrs);
}

void
cycintrdel(Cycintr *dci)
{
	Cycintr *ci, **last;

	ilock(&cycintrs);
	last = &cycintrs.ci;
	while(ci = *last){
		if(ci == dci){
			*last = ci->next;
			break;
		}
		last = &ci->next;
	}
	iunlock(&cycintrs);
}
.
## diffname pc/cycintr.c 2000/0627
## diff -e /n/emeliedump/2000/0623/sys/src/9/pc/cycintr.c /n/emeliedump/2000/0627/sys/src/9/pc/cycintr.c
62,63d
36a
	return 0;
.
35d
28,29c
		when = ci->when;
		if(when > fastticks(nil)){
			iunlock(&cycintrs);
			return when;
		}
.
24a
	vlong when;
.
21c
vlong
.
18a
	Cycintr *ci;
	vlong when;

	ilock(&cycintrs);
	when = 0;
	ci = cycintrs.ci;
	if(ci != nil)
		when = ci->when;
	iunlock(&cycintrs);
	return when;
.
16,17c
/*
 * called by clockintrsched()
 */
vlong
cycintrnext(void)
.
12d
## diffname pc/cycintr.c 2002/0405
## diff -e /n/emeliedump/2000/0627/sys/src/9/pc/cycintr.c /n/emeliedump/2002/0405/sys/src/9/pc/cycintr.c
95c
	iunlock(&timers);
.
86,87c
	ilock(&timers);
	last = &timers.ci;
.
84c
	Timer *ci, **last;
.
82c
timerdel(Timer *dci)
.
78c
	iunlock(&timers);
.
70c
	last = &timers.ci;
.
60,61c
	ilock(&timers);
	last = &timers.ci;
.
58c
	Timer *ci, **last;
.
56c
timeradd(Timer *nci)
.
51c
	iunlock(&timers);
.
49c
		ilock(&timers);
.
46,47c
		timers.ci = ci->next;
		iunlock(&timers);
.
43c
			iunlock(&timers);
.
39,40c
	ilock(&timers);
	while(ci = timers.ci){
.
36c
	Timer *ci;
.
34c
checktimer(Ureg *u, void*)
.
29c
	iunlock(&timers);
.
26c
	ci = timers.ci;
.
24c
	ilock(&timers);
.
21c
	Timer *ci;
.
19c
timernext(void)
.
12,13c
	Timer	*ci;
}timers;
.
## diffname pc/cycintr.c 2002/0411 # deleted
## diff -e /n/emeliedump/2002/0405/sys/src/9/pc/cycintr.c /n/emeliedump/2002/0411/sys/src/9/pc/cycintr.c
1,96d

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].