Home Help Center

operator! missing for IceUtil::Cond?

rbockrbock Member Roland BockOrganization: MetafeedProject: Session Cache
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

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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
  • rbockrbock Member Roland BockOrganization: MetafeedProject: Session Cache
    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
Sign In or Register to comment.