summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_Sched.cpp
blob: 879701a3ee70619a9bf51adeb3eae3c48182e955 (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
// $Id$

#include "EC_Gateway_Sched.h"
#include "orbsvcs/Time_Utilities.h"

ACE_RCSID(Event, EC_Gateway_sched, "$Id$")

TAO_EC_Gateway_Sched::TAO_EC_Gateway_Sched (void)
  :  TAO_EC_Gateway_IIOP ()
{
}

TAO_EC_Gateway_Sched::~TAO_EC_Gateway_Sched (void)
{
}

void
TAO_EC_Gateway_Sched::init (RtecEventChannelAdmin::EventChannel_ptr rmt_ec,
                           RtecEventChannelAdmin::EventChannel_ptr lcl_ec,
                           RtecScheduler::Scheduler_ptr rmt_sched,
                           RtecScheduler::Scheduler_ptr lcl_sched,
                           const char* lcl_name,
                           const char* rmt_name
                           ACE_ENV_ARG_DECL)
{
  ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_);

  this->init_i (rmt_ec, lcl_ec ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  // @@ Should we throw a system exception here?
  if (CORBA::is_nil (rmt_sched)
      || CORBA::is_nil (lcl_sched)
      || lcl_name == 0
      || rmt_name == 0)
    ACE_THROW (CORBA::BAD_PARAM ());

  this->rmt_info_ =
    rmt_sched->create (rmt_name ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  // @@ TODO Many things are hard-coded in the RT_Info here.

  // The worst case execution time is far less than 500 usecs, but
  // that is a safe estimate....
  ACE_Time_Value tv (0, 500);
  TimeBase::TimeT time;
  ORBSVCS_Time::Time_Value_to_TimeT (time, tv);
  rmt_sched->set (this->rmt_info_,
                  RtecScheduler::VERY_HIGH_CRITICALITY,
                  time, time, time,
                  25000 * 10,
                  RtecScheduler::VERY_LOW_IMPORTANCE,
                  time,
                  0,
                  RtecScheduler::OPERATION
                   ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  this->lcl_info_ =
    lcl_sched->create (lcl_name ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  tv = ACE_Time_Value (0, 500);
  ORBSVCS_Time::Time_Value_to_TimeT (time, tv);
  lcl_sched->set (this->lcl_info_,
                  RtecScheduler::VERY_HIGH_CRITICALITY,
                  time, time, time,
                  25000 * 10,
                  RtecScheduler::VERY_LOW_IMPORTANCE,
                  time,
                  1,
                  RtecScheduler::REMOTE_DEPENDANT
                   ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;
}