#include "ace/TP_Reactor.h"
#include "ace/Thread.h"
#include "ace/Timer_Queue.h"
#include "ace/Sig_Handler.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_sys_time.h"
Go to the source code of this file.
Functions | |
ACE_RCSID (ace, TP_Reactor,"$Id: TP_Reactor.cpp 85604 2009-06-11 13:26:00Z johnnyw $") 1 int ACE_TP_Token_Guard |
ACE_RCSID | ( | ace | , | |
TP_Reactor | , | |||
"$Id: TP_Reactor.cpp 85604 2009-06-11 13:26:00Z johnnyw $" | ||||
) |
Definition at line 14 of file TP_Reactor.cpp.
: TP_Reactor.cpp 85604 2009-06-11 13:26:00Z johnnyw $") ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE (ACE_TP_Reactor) int ACE_TP_Token_Guard::acquire_read_token (ACE_Time_Value *max_wait_time) { ACE_TRACE ("ACE_TP_Token_Guard::acquire_read_token"); // The order of these events is very subtle, modify with care. // Try to grab the lock. If someone if already there, don't wake // them up, just queue up in the thread pool. int result = 0; if (max_wait_time) { ACE_Time_Value tv = ACE_OS::gettimeofday (); tv += *max_wait_time; ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook, 0, &tv)); } else { ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook)); } // Check for timeouts and errors. if (result == -1) { if (errno == ETIME) return 0; else return -1; } // We got the token and so let us mark ourselves as owner this->owner_ = true; return result; }