Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-09-24 08:55:06

At 09:42 PM 9/23/2001, David Abrahams wrote:
>----- Original Message -----
>From: <williamkempf_at_[hidden]>
>> --- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
>> > No, it's just the idea that the condition waits (or sleeps, or
>> whatever else
>> > you choose to call it) that's really odd.
>> From another response I gather you find it odd only because the name
>> of the concept is "condition", and to you conditions don't wait.
>> You're thinking of the "condition" in terms of some boolean
>> expression. But this isn't precisely what a "condition" is... the
>> boolean expression isn't actually a part of the concept.
>> The "condition" is solely a synchronization object, and as such it
>> can and does "wait". Seems to me that what you'd really prefer is to
>> rename "condition", but there's too much historical meaning to do so.
>No, I don't think that's it at all. To my way of thinking, there are only
>few things in the system that can wait. I'll try to list all of them, or
>least all I can think of:
>the CPU
>the program
>a thread
>a process
>a daemon
>the user ;-)
>I don't really know what a condition is but a mutex is a synchronization
>object, and so is a semaphore. I can't see how either one waits.
>I'm not pressing on this because I think I know anything about the domain
>(well, I know a little, but not much). I'm doing it because there seems
>be a profound clash with my understanding of the English (and computer)
>semantics of the terminology. I don't think my sense of these things is
>off from how people commonly think, so IMO it merits some attention.

David Butenhof is an acknowledged threading expert, and is a precise writer
of English too. In his book, the first page of section 3.3.2 Waiting on a
condition variable, he uses the phrase "wait on condition variable" eight
times in talking about what threads do. He uses the phrase "wait for
condition variable" twice in talking about what user code must do. He uses
the term "condition variable wait operation" once. All this in relation to
the POSIX Threads pthread_cond_wait() and pthread_cond_timedwait().

So while only a thread "waits" (blocks), a condition variable certainly has
a wait operation. It is an indirect operation, in that it locks/unlocks
via the associated mutex. So it isn't precisely right to say the condition
waits. It is more precise to say the condition wait operation may cause
the thread to wait. Or simply, wait on the condition.

I'm not sure whose side of the discussion that supports:-)

I'm a bit uncomfortable with "condition" as the name, but
"condition_variable" doesn't seem right either. I can live with

Note also that the use of the term "condition variable" with a "wait"
operation goes back to the '60's and '70's, and people like Hoare. This
isn't something that Bill Kempf or the POSIX folks just made up.

[Are we supposed to call him Sir Anthony Hoare now? He was recently
knighted. Is he the first computer programmer to be so honored?]


Boost list run by bdawes at, gregod at, cpdaniel at, john at