1 #include "tao/GUIResource_Factory.h"
2 #include "ace/Reactor.h"
3 #include "ace/Guard_T.h"
6 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
10 GUIResource_Factory::GUIResource_Factory ()
11 : dynamically_allocated_reactor_ (false)
15 GUIResource_Factory::~GUIResource_Factory ()
20 GUIResource_Factory::get_reactor ()
22 // @@Marek, do we need a lock here??
23 // @Bala, I suppose we don't need locking for any
24 // reasonable use case as this
25 // factory is intended to be a variable in TSS.
26 // I can imagine that someone may try to use it in distinct
27 // threads, though I do not know
28 // what for. Nevertheless, just for a case I sync the creation of reactor.
29 // I think, that double checked locking is
30 // not necessary, because the performance is not an issue here.
31 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
, ace_mon
, this->lock_
, nullptr);
33 ACE_Reactor
*reactor
= nullptr;
34 ACE_NEW_RETURN (reactor
,
35 ACE_Reactor (this->reactor_impl (), 1),
38 if (reactor
->initialized () == 0)
44 this->dynamically_allocated_reactor_
= true;
50 GUIResource_Factory::reclaim_reactor (ACE_Reactor
*reactor
)
52 ACE_GUARD ( TAO_SYNCH_MUTEX
, ace_mon
, this->lock_
);
54 if (this->dynamically_allocated_reactor_
)
59 TAO_END_VERSIONED_NAMESPACE_DECL