summaryrefslogtreecommitdiff
path: root/TAO/tao/Wait_On_LF_No_Upcall.h
blob: caf40f3882835c558c4ffb8dffe05c0fd12504f9 (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
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Wait_On_LF_No_Upcall.h
 *
 *  @author  Chris Cleeland <cleeland@ociweb.com>
 */
//=============================================================================


#ifndef TAO_WAIT_ON_LF_NO_UPCALL_H
#define TAO_WAIT_ON_LF_NO_UPCALL_H

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

#include "tao/Wait_On_Leader_Follower.h"

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

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  /**
   * @class TAO_Wait_On_LF_No_Upcall
   *
   * @brief Wait according to the Leader-Follower model (like
   * TAO_Wait_On_Leader_Follower), but do not allow nested upcalls.
   *
   * This implementation sets a thread-specific flag on entering wait()
   * that indicates that the thread is unavailable to service upcalls.
   * Connection handler that are acting in a server role cooperate by
   * checking this flag in their handle_input, and returning if they're
   * in a thread that is currently suspending upcalls. The flag gets
   * reset once the reply is received.
   */
  class Wait_On_LF_No_Upcall : public TAO_Wait_On_Leader_Follower
  {
  public:
     /// Constructor.
    explicit Wait_On_LF_No_Upcall (TAO_Transport *t);

    /// Destructor.
    ~Wait_On_LF_No_Upcall () override = default;

    /*! @copydoc TAO_Wait_Strategy::wait() */
    int wait (ACE_Time_Value *max_wait_time, TAO_Synch_Reply_Dispatcher &rd) override;

    /*! @copydoc TAO_Wait_Strategy::can_process_upcalls() */
    bool can_process_upcalls () const override;

    /*! @copydoc TAO_Wait_Strategy::defer_upcall() */
    int defer_upcall (ACE_Event_Handler*) override;
  };
}

TAO_END_VERSIONED_NAMESPACE_DECL

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

#endif /* TAO_WAIT_ON_LF_NO_UPCALL_H */