summaryrefslogtreecommitdiff
path: root/ACE/Kokyu/Kokyu_defs.cpp
blob: e474da88d0bc32bc7b06316fb91769d5461c0453 (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
#include "Kokyu_defs.h"

#if ! defined (__ACE_INLINE__)
#include "Kokyu_defs.inl"
#endif /* __ACE_INLINE__ */

namespace Kokyu
{
   Dispatch_Command::~Dispatch_Command ()
   {
   }

  DSRT_ConfigInfo::DSRT_ConfigInfo ()
    :sched_policy_ (ACE_SCHED_RR),
     sched_scope_ (ACE_SCOPE_THREAD)
  {
  }

Dispatcher_Attributes::Dispatcher_Attributes()
    :immediate_activation_ (0),
     sched_policy_ (ACE_SCHED_FIFO),
     sched_scope_ (ACE_SCOPE_THREAD),
     base_thread_creation_flags_ (THR_NEW_LWP | THR_BOUND | THR_JOINABLE)
{
}

int Dispatcher_Attributes::thread_creation_flags () const
{
   int thread_creation_flags = base_thread_creation_flags_;

   switch (sched_policy_)
   {
      case ACE_SCHED_FIFO:
         thread_creation_flags |= THR_SCHED_FIFO;
         break;

      case ACE_SCHED_OTHER:
         thread_creation_flags |= THR_SCHED_DEFAULT;
         break;

      case ACE_SCHED_RR:
         thread_creation_flags |= THR_SCHED_RR;
         break;
   }

   switch (sched_scope_)
   {
      case ACE_SCOPE_PROCESS:
      case ACE_SCOPE_LWP:
         thread_creation_flags |= THR_SCOPE_PROCESS;
         break;

      case ACE_SCOPE_THREAD:
      default:
         thread_creation_flags |= THR_SCOPE_SYSTEM;
         break;
   }
   return thread_creation_flags;
}

}