Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
Utils.h
1/*
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2.1 of the License, or (at your option) any later version.
6 *
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 * Utils.h
17 * Helper functions for threads.
18 * Copyright (C) 2014 Simon Newton
19 */
20
21#ifndef INCLUDE_OLA_THREAD_UTILS_H_
22#define INCLUDE_OLA_THREAD_UTILS_H_
23
24#ifdef _WIN32
25// On MinGW, pthread.h pulls in Windows.h, which in turn pollutes the global
26// namespace. We define VC_EXTRALEAN and WIN32_LEAN_AND_MEAN to reduce this.
27#define VC_EXTRALEAN
28#define WIN32_LEAN_AND_MEAN
29#endif // _WIN32
30#include <pthread.h>
31#include <string>
32
33namespace ola {
34namespace thread {
35
41std::string PolicyToString(int policy);
42
50bool SetSchedParam(pthread_t thread, int policy,
51 const struct sched_param &param);
52
53} // namespace thread
54} // namespace ola
55#endif // INCLUDE_OLA_THREAD_UTILS_H_
bool SetSchedParam(pthread_t thread, int policy, const struct sched_param &param)
Wraps pthread_setschedparam().
Definition Utils.cpp:55
std::string PolicyToString(int policy)
Convert a scheduling policy to a string.
Definition Utils.cpp:42
The namespace containing all OLA symbols.
Definition Credentials.cpp:44