blob: 3dd562582f1b12f3be2d7b55b97b9a0f087fed99 (
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
|
/**
* @file RT_Class.cpp
*
* @author Carlos O'Ryan <coryan@uci.edu>
*/
#include "RT_Class.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_errno.h"
#if !defined(__ACE_INLINE__)
#include "RT_Class.inl"
#endif /* __ACE_INLINE__ */
RT_Class::RT_Class (void)
: prc_sched_class_ (ACE_SCHED_FIFO)
, thr_sched_class_ (THR_SCHED_FIFO)
{
int priority =
(ACE_Sched_Params::priority_min (this->prc_sched_class_)
+ ACE_Sched_Params::priority_max (this->prc_sched_class_)) / 2;
if (ACE_OS::sched_params (ACE_Sched_Params (this->prc_sched_class_,
priority,
ACE_SCOPE_PROCESS)) != 0)
{
if (ACE_OS::last_error () == EPERM)
{
ACE_DEBUG ((LM_DEBUG,
"WARNING (%P|%t) user does not have "
"permissions to run real-time tests.\n"
"The test will run in the time-shared "
"class, it may fail or produce unpredictable "
"results\n"));
this->prc_sched_class_ = ACE_SCHED_OTHER;
this->thr_sched_class_ = THR_SCHED_DEFAULT;
}
}
this->priority_low_ =
ACE_Sched_Params::priority_min (this->prc_sched_class_);
this->priority_high_ =
ACE_Sched_Params::priority_max (this->prc_sched_class_);
this->priority_process_ =
(this->priority_low_ + this->priority_high_) / 2;
}
|