Created
September 21, 2012 15:09
-
-
Save yifu/3762065 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "ace/Task.h" | |
| #include "ace/Message_Queue.h" | |
| #include "ace/Synch_Traits.h" | |
| #include "ace/Thread_Mutex.h" | |
| #include <cerrno> | |
| #include <iostream> | |
| int main() | |
| { | |
| std::cout << "Hello world" << std::endl; | |
| std::cout << "EAGAIN[" << EAGAIN << "] ETIME [" << ETIME << "] ETIMEDOUT [" << ETIMEDOUT << "]" << std::endl; | |
| ACE_Message_Queue<ACE_MT_SYNCH> queue; | |
| queue.activate(); | |
| const size_t waterMark = 100 * 16384; | |
| queue.high_water_mark(waterMark); | |
| queue.low_water_mark (waterMark); | |
| ACE_Message_Block* mb = 0; | |
| ACE_Time_Value tv = ACE_OS::gettimeofday(); | |
| tv.sec ( tv.sec() + 10 ); | |
| const int result = queue.dequeue_head ( mb, &tv ); | |
| if ( result == -1 ) | |
| { | |
| const int errNo = errno; | |
| std::cout << "errNo [" << errNo << "]" << std::endl; | |
| } | |
| std::cout << "Finish" << std::endl; | |
| ACE_Task<ACE_MT_SYNCH> task; | |
| task.getq( mb, &tv ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment