Date: Sat, 20 Nov 2004 02:18:59 GMT From: David Xu <davidxu@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 65488 for review Message-ID: <200411200218.iAK2IxFY099254@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=65488 Change 65488 by davidxu@davidxu_alona on 2004/11/20 02:18:27 if a thread is resumed by thr_wake, it should return 0, for example, a signal can cause ERESTART to be returned, this will cause the wakeup to be lost. Affected files ... .. //depot/projects/davidxu_thread/src/sys/kern/kern_thr.c#3 edit Differences ... ==== //depot/projects/davidxu_thread/src/sys/kern/kern_thr.c#3 (text+ko) ==== @@ -270,11 +270,21 @@ if ((td->td_flags & TDF_THRWAKEUP) == 0) error = msleep((void *)td, &td->td_proc->p_mtx, td->td_priority | PCATCH, "lthr", hz); - mtx_lock_spin(&sched_lock); - td->td_flags &= ~TDF_THRWAKEUP; - mtx_unlock_spin(&sched_lock); + if (td->td_flags & TDF_THRWAKEUP) { + mtx_lock_spin(&sched_lock); + td->td_flags &= ~TDF_THRWAKEUP; + mtx_unlock_spin(&sched_lock); + PROC_UNLOCK(td->td_proc); + return (0); + } PROC_UNLOCK(td->td_proc); - return (error == EWOULDBLOCK ? ETIMEDOUT : error); + if (error == EWOULDBLOCK) + error = ETIMEDOUT; + else if (error == ERESTART) { + if (hz != 0) + error = EINTR; + } + return (error); } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411200218.iAK2IxFY099254>