summaryrefslogtreecommitdiff
path: root/TAO/tao/LF_Event_Loop_Thread_Helper.h
blob: 3d5dfd955819b3cdb27d359364bf8d87494c6557 (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
61
62
63
64
65
66
67
// -*- C++ -*-

//=============================================================================
/**
 *  @file LF_Event_Loop_Thread_Helper.h
 *
 *  $Id$
 *
 *  @author Carlos O'Ryan <coryan@uci.edu>
 */
//=============================================================================

#ifndef TAO_LF_EVENT_LOOP_THREAD_HELPER_H
#define TAO_LF_EVENT_LOOP_THREAD_HELPER_H

#include /**/ "ace/pre.h"

#include "tao/LF_Strategy.h"

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

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @brief Helper class to enter and exit the Leader/Followers event
 * loop.
 *
 * Uses the Guard idiom to enter and exit the Leader/Followers event
 * loop.
 */
class TAO_Export TAO_LF_Event_Loop_Thread_Helper
{
public:
  /// Constructor
  TAO_LF_Event_Loop_Thread_Helper (TAO_Leader_Follower &leader_follower,
                                   TAO_LF_Strategy &lf_strategy,
                                   ACE_Time_Value *max_wait_time);

  /// Destructor
  ~TAO_LF_Event_Loop_Thread_Helper (void);

  /// Calls <set_event_loop_thread> on the leader/followers object.
  int event_loop_return (void) const;

private:
  /// Reference to leader/followers object.
  TAO_Leader_Follower &leader_follower_;

  /// The Leader/Follower Strategy used by this ORB.
  TAO_LF_Strategy &lf_strategy_;

  /// Remembers the status returned while trying to enter the event
  /// loop.
  int event_loop_return_;
};

TAO_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
# include "tao/LF_Event_Loop_Thread_Helper.inl"
#endif /* __ACE_INLINE__ */

#include /**/ "ace/post.h"

#endif  /* TAO_LF_EVENT_LOOP_THREAD_HELPER_H */