[ace-users] why ACE_Semaphore::acquire (ACE_Time_Value &tv); block?

Johnny Willemsen jwillemsen at remedy.nl
Sat Jul 28 01:43:21 CDT 2007


Hi,

Thanks for using the PRF form. The acquire method requires absolute =
time,
you can use "ACE_OS::gettimeofday ()" to get the actual time. See also
tests/Semaphore_Test.cpp

Regards,

Johnny Willemsen
Remedy IT
Postbus 101
2650 AC  Berkel en Rodenrijs
The Netherlands
www.theaceorb.nl / www.remedy.nl =20

*** Integrated compile and test statistics see
http://scoreboard.theaceorb.nl ***
*** Commercial service and support for ACE/TAO/CIAO             ***
*** See http://www.theaceorb.nl/en/support.html                 ***

> HI :
> PRF:
> ACE VERSION: 5.5.9
>=20
>    HOST MACHINE and OPERATING SYSTEM:
>         Red Hat Enterprise Linux AS release 4 (Nahant Update 3)  run
> on wmware workstation 6.0
>=20
>    COMPILER NAME AND VERSION (AND PATCHLEVEL):
>    gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)
>=20
>    Question:
>    I wirte simple test:
>    #include <ace/Semaphore.h>
>    #include <ace/Time_Value.h>
>    #include <ace/OS.h>
>    #include <iostream>
>=20
>   int main (int argc, char *argv[])
>   {
>     ACE_Semaphore sem (0);
>     ACE_Time_Value tv (ACE_OS::time (NULL) + 5);
>     sem.acquire (&tv);                 // but it does't block , if use
> sem.acquire () it's block
>     std::cout << "over" << std::endl;
>     return 0;
>   }
>   why use timeout acquire doesn't block?
>=20
> --=20
> |  (\_/)  This is Bunny. Copy and paste Bunny
> | (=3D'.'=3D) into your signature to help him gain
> | (")_(") world domination.
>=20
> =B4=DE=C9=D9=CE=B0
> Tel:    13810421852
> QQ:    43458943
> MSN: shaovie at hotmail.com
>=20



More information about the Ace-users mailing list