Archived

This forum has been archived. Please start a new discussion on GitHub.

operator! missing for IceUtil::Cond?

Hi,

first of all: ICE is NICE! Thank you for providing it! :)

I seem to have some trouble understanding IceUtil::Cond documentation at http://www.zeroc.com/doc/Ice-3.3.1/manual/Threads.32.9.html

I think the following code should compile:

<snip>
#include <IceUtil/Cond.h>

int main()
{
IceUtil::Cond c;

while(!c)
{
}
}
</snip>

But I get:

$ g++ test.cpp
test.cpp: In function 'int main()':
test.cpp:8: error: no match for 'operator!' in '!c'
test.cpp:8: note: candidates are: operator!(bool) <built-in>

I am using version 3.3.1 on FreeBsd and 3.2.1 on Ubuntu.

Thanks and regards,

Roland

Comments

  • bernard
    bernard Jupiter, FL
    Hi Roland,

    Welcome to our forums!

    IceUtil::Cond has no operator!. When you use a condition variable, you typically have an associated expression/condition (e.g. a flag or a counter) that you check. See Spurious wakeup - Wikipedia, the free encyclopedia.

    You don't check the condition variable itself.

    Cheers,
    Bernard
  • Bernard,

    thanks for the explanation.

    I must admit that the use of the word condition in the documentation was too ambiguous for me, but now I got it. Maybe it would have been sufficient to simply add your answer to the documentation.

    Regards,

    Roland
    bernard wrote: »
    Hi Roland,

    Welcome to our forums!

    IceUtil::Cond has no operator!. When you use a condition variable, you typically have an associated expression/condition (e.g. a flag or a counter) that you check. See Spurious wakeup - Wikipedia, the free encyclopedia.

    You don't check the condition variable itself.

    Cheers,
    Bernard