summaryrefslogtreecommitdiff
path: root/TAO/tao/ORB_Strategies_T.cpp
blob: f5cb47578431bb7de04fc817d2efac2d188ca471 (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
// $Id$

#ifndef ORB_STRATEGIES_T_C
#define ORB_STRATEGIES_T_C

#include "tao/ORB_Strategies_T.h"

#if !defined (__ACE_INLINE__)
#include "tao/ORB_Strategies_T.i"
#endif /* __ACE_INLINE__ */

ACE_RCSID(tao, ORB_Strategies_T, "$Id$")

template <class SH> int
TAO_Reactive_Strategy<SH>::activate_svc_handler (SH *svc_handler, void *arg)
{
  ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::activate_svc_handler");

  ACE_Reactor *r = TAO_ORB_Core_instance ()->reactor ();

  int result = 0;

  if (r == 0)
    result = -1;

  // Register with the Reactor with the appropriate <mask>.
  else if (r->register_handler (svc_handler, this->mask_) == -1)
    result = -1;

  // If the implementation of the reactor uses event associations
  else if (r->uses_event_associations ())
    {
      // If we don't have non-block on, it won't work with
      // WFMO_Reactor
      // This maybe too harsh
      // if (!ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK))
      // goto failure;
      if (svc_handler->open ((void *) this) != -1)
        return 0;
      else
        result = -1;
    }
  else
    // Call up to our parent to do the SVC_HANDLER initialization.
    return this->inherited::activate_svc_handler (svc_handler, arg);

  if (result == -1)
    svc_handler->close (0);

  return result;
}

#endif /* ! ORB_STRATEGIES_T_C */