Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
x
y
Typedefs
a
b
c
d
f
h
i
n
o
p
q
r
s
t
u
Enumerations
a
c
d
e
f
i
m
n
p
q
r
s
t
u
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
a
b
c
d
e
f
g
i
l
m
n
p
r
s
t
u
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
Related Functions
c
e
h
i
m
o
p
q
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
x
z
Variables
a
b
c
e
g
i
l
m
n
p
r
s
t
v
x
y
Typedefs
a
b
c
d
e
f
h
i
l
m
n
p
q
r
s
t
u
Enumerator
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
src
core
include
corbo-core
threads.h
Go to the documentation of this file.
1
/*********************************************************************
2
*
3
* Software License Agreement
4
*
5
* Copyright (c) 2020,
6
* TU Dortmund - Institute of Control Theory and Systems Engineering.
7
* All rights reserved.
8
*
9
* This program is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <https://www.gnu.org/licenses/>.
21
*
22
* Authors: Christoph Rösmann
23
*********************************************************************/
24
25
#ifndef SRC_CORE_INCLUDE_CORBO_CORE_THREADS_H_
26
#define SRC_CORE_INCLUDE_CORBO_CORE_THREADS_H_
27
28
#include <thread>
29
30
#if !defined(DISABLE_IO)
31
#include <cstring>
32
#include <iostream>
33
#endif
34
35
#ifdef __unix__
36
#include <pthread.h>
// required for set_thread_scheduling
37
#endif
38
39
namespace
corbo
{
40
41
namespace
threads {
42
48
inline
bool
set_thread_scheduling
(std::thread& th,
int
priority)
// priority 1-99
49
{
50
#ifdef __unix__
51
sched_param sch_params;
52
sch_params.sched_priority = priority;
53
if
(pthread_setschedparam(th.native_handle(), SCHED_RR, &sch_params))
54
{
55
#if !defined(DISABLE_IO)
56
std::cerr <<
"Failed to set Thread scheduling : "
<< std::strerror(errno) << std::endl;
57
#endif
58
return
false
;
59
}
60
return
true
;
61
#else
62
return
false
;
63
#endif
64
}
65
66
}
// namespace threads
67
68
}
// namespace corbo
69
70
#endif // SRC_CORE_INCLUDE_CORBO_CORE_THREADS_H_
corbo
Definition:
communication/include/corbo-communication/utilities.h:37
corbo::threads::set_thread_scheduling
bool set_thread_scheduling(std::thread &th, int priority)
Change the scheduling priority of a thread.
Definition:
threads.h:92
control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:07:06