PERFORCE change 92235 for review
John Baldwin
jhb at FreeBSD.org
Wed Feb 22 13:40:44 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=92235
Change 92235 by jhb at jhb_slimer on 2006/02/22 21:40:30
Feh.
Affected files ...
.. //depot/projects/smpng/sys/kern/kern_timeout.c#29 edit
Differences ...
==== //depot/projects/smpng/sys/kern/kern_timeout.c#29 (text+ko) ====
@@ -472,7 +472,7 @@
struct callout *c;
int safe;
{
- int rval, use_mtx;
+ int use_mtx;
if (!safe && c->c_mtx != NULL) {
#ifdef notyet /* Some callers do not hold Giant for Giant-locked callouts. */
@@ -488,8 +488,8 @@
mtx_lock_spin(&callout_lock);
/*
* If the callout isn't pending, it's not on the queue, so
- * don't attempt to remove it from the queue. We can try
- * to stop it by other means however.
+ * don't attempt to remove it from the queue. We can try to
+ * stop it by other means however.
*/
if (!(c->c_flags & CALLOUT_PENDING)) {
c->c_flags &= ~CALLOUT_ACTIVE;
@@ -498,32 +498,37 @@
* If it wasn't on the queue and it isn't the current
* callout, then we can't stop it, so just bail.
*/
- if (c != curr_callout)
- rval = 0;
- else if (safe) {
+ if (c != curr_callout) {
+ mtx_unlock_spin(&callout_lock);
+ return (0);
+ }
+
+ if (safe) {
/*
- * The current callout is running (or just about to
- * run) and blocking is allowed, so just wait for
- * the current invocation to finish.
+ * The current callout is running (or just
+ * about to run) and blocking is allowed, so
+ * just wait for the current invocation to
+ * finish.
*/
while (c == curr_callout) {
callout_wait = 1;
msleep_spin(&callout_wait, &callout_lock,
"codrain", 0);
}
- rval = 0;
} else if (use_mtx && !curr_cancelled) {
/*
- * The current callout is waiting for it's mutex
- * which we hold. Cancel the callout and return.
- * After our caller drops the mutex, the callout
- * will be skipped in softclock().
+ * The current callout is waiting for it's
+ * mutex which we hold. Cancel the callout
+ * and return. After our caller drops the
+ * mutex, the callout will be skipped in
+ * softclock().
*/
curr_cancelled = 1;
- rval = 1;
+ mtx_unlock_spin(&callout_lock);
+ return (1);
}
mtx_unlock_spin(&callout_lock);
- return (rval);
+ return (0);
}
c->c_flags &= ~(CALLOUT_ACTIVE | CALLOUT_PENDING);
More information about the p4-projects
mailing list