Simplify example of cv_timedwaitbt.
It is simpler if there is only one place we check the condition. That said, there are cases where the caller needs to re-check before choosing to fail (e.g., futex_wait in kern/sys_futex.c, which must verify the condition before taking destructive steps to abort the wait). But it's not clear that that's the norm.
This commit is contained in:
parent
a36c0b2b71
commit
5b0aa16b11
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: condvar.9,v 1.23 2020/05/03 04:04:32 riastradh Exp $
|
.\" $NetBSD: condvar.9,v 1.24 2020/05/03 04:05:00 riastradh Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
|
.\" Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
@ -305,8 +305,6 @@ Consuming a resource:
|
|||||||
&res->mutex, &timeout, DEFAULT_TIMEOUT_EPSILON);
|
&res->mutex, &timeout, DEFAULT_TIMEOUT_EPSILON);
|
||||||
if (error) {
|
if (error) {
|
||||||
KASSERT(error == EWOULDBLOCK);
|
KASSERT(error == EWOULDBLOCK);
|
||||||
if (res->state != BUSY)
|
|
||||||
break;
|
|
||||||
mutex_exit(&res->mutex);
|
mutex_exit(&res->mutex);
|
||||||
return ETIMEDOUT;
|
return ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user