Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Re-add yield(). Only used by compat code at the moment.
details: https://anonhg.NetBSD.org/src/rev/ea33fd2eb2b3
branches: trunk
changeset: 540693:ea33fd2eb2b3
user: gmcgarry <gmcgarry%NetBSD.org@localhost>
date: Sat Dec 21 23:52:05 2002 +0000
description:
Re-add yield(). Only used by compat code at the moment.
diffstat:
sys/kern/kern_synch.c | 25 +++++++++++++++++++++++--
sys/sys/proc.h | 3 ++-
2 files changed, 25 insertions(+), 3 deletions(-)
diffs (63 lines):
diff -r 05bd2aa6c8aa -r ea33fd2eb2b3 sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c Sat Dec 21 23:50:47 2002 +0000
+++ b/sys/kern/kern_synch.c Sat Dec 21 23:52:05 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_synch.c,v 1.116 2002/12/20 05:43:09 gmcgarry Exp $ */
+/* $NetBSD: kern_synch.c,v 1.117 2002/12/21 23:52:06 gmcgarry Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.116 2002/12/20 05:43:09 gmcgarry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.117 2002/12/21 23:52:06 gmcgarry Exp $");
#include "opt_ddb.h"
#include "opt_ktrace.h"
@@ -718,6 +718,27 @@
}
/*
+ * General yield call. Puts the current process back on its run queue and
+ * performs a voluntary context switch. Should only be called when the
+ * current process explicitly requests it (eg sched_yield(2) in compat code).
+ */
+void
+yield(void)
+{
+ struct proc *p = curproc;
+ int s;
+
+ SCHED_LOCK(s);
+ p->p_priority = p->p_usrpri;
+ p->p_stat = SRUN;
+ setrunqueue(p);
+ p->p_stats->p_ru.ru_nvcsw++;
+ mi_switch(p, NULL);
+ SCHED_ASSERT_UNLOCKED();
+ splx(s);
+}
+
+/*
* General preemption call. Puts the current process back on its run queue
* and performs an involuntary context switch. If a process is supplied,
* we switch to that process. Otherwise, we use the normal process selection
diff -r 05bd2aa6c8aa -r ea33fd2eb2b3 sys/sys/proc.h
--- a/sys/sys/proc.h Sat Dec 21 23:50:47 2002 +0000
+++ b/sys/sys/proc.h Sat Dec 21 23:52:05 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.h,v 1.151 2002/12/21 16:22:10 manu Exp $ */
+/* $NetBSD: proc.h,v 1.152 2002/12/21 23:52:05 gmcgarry Exp $ */
/*-
* Copyright (c) 1986, 1989, 1991, 1993
@@ -437,6 +437,7 @@
void fixjobc(struct proc *p, struct pgrp *pgrp, int entering);
int inferior(struct proc *p, struct proc *q);
int leavepgrp(struct proc *p);
+void yield(void);
void preempt(struct proc *);
void mi_switch(struct proc *, struct proc *);
struct proc *chooseproc(void);
Home |
Main Index |
Thread Index |
Old Index