summaryrefslogtreecommitdiff
path: root/TAO/tao/PortableServer/Non_Servant_Upcall.h
blob: 750416605937d617a01bc6deefb1f37167f992b4 (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
68
69
70
71
72
73
74
75
76
77
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Non_Servant_Upcall.h
 *
 *  @author Irfan Pyarali
 */
//=============================================================================

#ifndef TAO_NONSERVANT_UPCALL_H
#define TAO_NONSERVANT_UPCALL_H

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

#include "tao/PortableServer/portableserver_export.h"

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

#include "tao/orbconf.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

// Forward declaration
class TAO_Root_POA;
class TAO_Object_Adapter;

namespace TAO
{
  namespace Portable_Server
  {
    /**
     * @class Non_Servant_Upcall
     *
     * @brief This class helps us with a recursive thread lock without
     * using a recursive thread lock.  Non_Servant_Upcall has a
     * magic constructor and destructor.  We unlock the
     * Object_Adapter lock for the duration of the non-servant
     * (i.e., adapter activator and servant activator) upcalls;
     * reacquiring once the upcalls complete.  Even though we are
     * releasing the lock, other threads will not be able to make
     * progress since
     * <Object_Adapter::non_servant_upcall_in_progress_> has been
     * set.
     */
    class TAO_PortableServer_Export Non_Servant_Upcall
    {
    public:

      /// Constructor.
      Non_Servant_Upcall (::TAO_Root_POA &poa);

      /// Destructor.
      ~Non_Servant_Upcall ();

      ::TAO_Root_POA &poa () const;

    protected:

      TAO_Object_Adapter &object_adapter_;
      TAO_Root_POA &poa_;
      Non_Servant_Upcall *previous_;
    };
  }
}

TAO_END_VERSIONED_NAMESPACE_DECL

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

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

#endif /* TAO_NONSERVANT_UPCALL_H */