Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / Nested_Upcall_Guard.h
blobe13950c4b07261a339ba91290353bb635e629a6e
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Nested_Upcall_Guard.h
7 * @author Chris Cleeland <cleeland@ociweb.com>
8 */
9 //=============================================================================
12 #ifndef TAO_NESTED_UPCALL_GUARD_H
13 #define TAO_NESTED_UPCALL_GUARD_H
15 #include /**/ "ace/pre.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "tao/Transport.h"
22 #include "tao/ORB_Core.h"
23 #include "tao/ORB_Core_TSS_Resources.h"
24 #include "tao/debug.h"
26 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
27 namespace TAO
29 /**
30 * @class Nested_Upcall_Guard
32 * @brief: Magic class that sets the status of the thread in the
33 * TSS.
35 * This class was originally internal to the Wait_On_LF_NoUpcall
36 * implementation, but now it needs to be shared with the LF
37 * Connect wait as well.
39 class Nested_Upcall_Guard
41 public:
42 // Maybe we should instead just take in a ptr to
43 // TAO_ORB_Core_TSS_Resources? Or at least ORB_Core*?
44 explicit Nested_Upcall_Guard (TAO_Transport *t, bool enable=true)
45 : t_ (t),
46 enable_ (enable)
48 if (!this->enable_)
50 return;
53 TAO_ORB_Core_TSS_Resources *tss =
54 t_->orb_core ()->get_tss_resources ();
56 tss->upcalls_temporarily_suspended_on_this_thread_ = true;
58 if (TAO_debug_level > 6)
59 TAOLIB_DEBUG ((LM_DEBUG,
60 "TAO (%P|%t) - Wait_On_LF_No_Upcall[%d]::wait, "
61 "disabling upcalls\n", t->id ()));
64 ~Nested_Upcall_Guard ()
66 if (!this->enable_)
68 return;
71 TAO_ORB_Core_TSS_Resources *tss =
72 this->t_->orb_core ()->get_tss_resources ();
74 tss->upcalls_temporarily_suspended_on_this_thread_ = false;
76 if (TAO_debug_level > 6)
78 TAOLIB_DEBUG ((LM_DEBUG,
79 "TAO (%P|%t) - Wait_On_LF_No_Upcall[%d]::wait, "
80 "re-enabling upcalls\n", this->t_->id ()));
84 private:
85 Nested_Upcall_Guard ();
87 Nested_Upcall_Guard (const Nested_Upcall_Guard&) = delete;
88 Nested_Upcall_Guard &operator= (const Nested_Upcall_Guard&) = delete;
89 Nested_Upcall_Guard (Nested_Upcall_Guard&&) = delete;
90 Nested_Upcall_Guard &operator= (Nested_Upcall_Guard&&) = delete;
92 private:
93 /// Pointer to the transport that we plan to use.
94 TAO_Transport *t_;
96 /// A flag to support conditional waiting in the LF_Connect_Strategy
97 bool enable_;
101 TAO_END_VERSIONED_NAMESPACE_DECL
103 #include /**/ "ace/post.h"
105 #endif /* TAO_NESTED_UPCALL_GUARD_H */