TP_Reactor.cpp File Reference

#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"
Include dependency graph for TP_Reactor.cpp:

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

Function Documentation

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.

00016                : TP_Reactor.cpp 85604 2009-06-11 13:26:00Z johnnyw $")
00017 
00018 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00019 
00020 ACE_ALLOC_HOOK_DEFINE (ACE_TP_Reactor)
00021 
00022 int
00023 ACE_TP_Token_Guard::acquire_read_token (ACE_Time_Value *max_wait_time)
00024 {
00025   ACE_TRACE ("ACE_TP_Token_Guard::acquire_read_token");
00026 
00027   // The order of these events is very subtle, modify with care.
00028 
00029   // Try to grab the lock.  If someone if already there, don't wake
00030   // them up, just queue up in the thread pool.
00031   int result = 0;
00032 
00033   if (max_wait_time)
00034     {
00035       ACE_Time_Value tv = ACE_OS::gettimeofday ();
00036       tv += *max_wait_time;
00037 
00038       ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook,
00039                                                   0,
00040                                                   &tv));
00041     }
00042   else
00043     {
00044       ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook));
00045     }
00046 
00047   // Check for timeouts and errors.
00048   if (result == -1)
00049     {
00050       if (errno == ETIME)
00051         return 0;
00052       else
00053         return -1;
00054     }
00055 
00056   // We got the token and so let us mark ourselves as owner
00057   this->owner_ = true;
00058 
00059   return result;
00060 }

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Sun Nov 22 23:13:17 2009 for ACE by  doxygen 1.6.1