Date: Wed, 22 Feb 2006 21:40:42 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 92235 for review Message-ID: <200602222140.k1MLegeu087720@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=92235 Change 92235 by jhb@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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602222140.k1MLegeu087720>