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:
riastradh 2020-05-03 04:05:00 +00:00
parent a36c0b2b71
commit 5b0aa16b11

View File

@ -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.
.\" All rights reserved.
@ -305,8 +305,6 @@ Consuming a resource:
&res->mutex, &timeout, DEFAULT_TIMEOUT_EPSILON);
if (error) {
KASSERT(error == EWOULDBLOCK);
if (res->state != BUSY)
break;
mutex_exit(&res->mutex);
return ETIMEDOUT;
}