summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Event/Fast_Reactor.h
blob: ced85087e9364e64d864bcd364a9d3070341349d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// $Id$
//
#ifndef FAST_REACTOR_H
#define FAST_REACTOR_H

#if defined (ACE_OLD_STYLE_REACTOR)
# if defined (ACE_WIN32)
#   include "ace/ReactorEx.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#   define ACE_ES_FAST_REACTOR_BASE ACE_ReactorEx
# else
#   include "ace/Reactor.h"
#   define ACE_ES_FAST_REACTOR_BASE ACE_Reactor
# endif /* ACE_WIN32 */
#else
# if defined (ACE_WIN32)
#   include "ace/WFMO_Reactor.h"
#   define ACE_ES_FAST_REACTOR_BASE ACE_WFMO_Reactor
# else
#   include "ace/Select_Reactor.h"
#   define ACE_ES_FAST_REACTOR_BASE ACE_Select_Reactor
# endif /* ACE_WIN32 */
#endif /* ACE_OLD_STYLE_REACTOR */
//## end module.includes

#include "orbsvcs/orbsvcs_export.h"

class TAO_ORBSVCS_Export ACE_ES_Fast_Reactor : public ACE_ES_FAST_REACTOR_BASE
{
public:
  virtual int handle_events (ACE_Time_Value *max_wait_time = 0)
  {
    ACE_Time_Value timer_buf (0) ;
    ACE_Time_Value *this_timeout = &timer_buf ;

    if (this->timer_queue_->calculate_timeout (max_wait_time,
                                               this_timeout) == 0)
      {
        ACE_Time_Value t (0, 500000);
        ACE_OS::select (0, 0, 0, 0, &t);
      }
    else
      {
        ACE_OS::select (0, 0, 0, 0, this_timeout);
      }

    return this->timer_queue_->expire () == -1 ? -1 : 0;
  }
  virtual int handle_events (ACE_Time_Value &max_wait_time)
  {
    return this->handle_events (&max_wait_time);
  }
};

#endif /* FAST_REACTOR_H */