Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / PortableServer / POA_Guard.cpp
blob0a2353e4fdaa58aba6650497d9efb33fa1144a6d
1 #include "tao/PortableServer/POA_Guard.h"
2 #include "tao/PortableServer/Root_POA.h"
3 #include "tao/ORB_Constants.h"
5 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
7 namespace TAO
9 namespace Portable_Server
11 POA_Guard::POA_Guard (::TAO_Root_POA &poa, bool check_for_destruction)
12 : guard_ (poa.lock ())
14 if (!this->guard_.locked ())
15 throw
16 CORBA::INTERNAL (
17 CORBA::SystemException::_tao_minor_code (
18 TAO_GUARD_FAILURE,
19 0),
20 CORBA::COMPLETED_NO);
22 // Check if a non-servant upcall is in progress. If a non-servant
23 // upcall is in progress, wait for it to complete. Unless of
24 // course, the thread making the non-servant upcall is this thread.
25 poa.object_adapter ().wait_for_non_servant_upcalls_to_complete ();
27 if (check_for_destruction && poa.cleanup_in_progress ())
29 throw
30 CORBA::BAD_INV_ORDER (
31 CORBA::SystemException::_tao_minor_code (
32 TAO_POA_BEING_DESTROYED,
33 0),
34 CORBA::COMPLETED_NO);
40 TAO_END_VERSIONED_NAMESPACE_DECL