* Reduce maximum priority to B_URGENT_DISPLAY_PRIORITY; real time threads isn't
really something to play with without knowing the outcome. * Fixed indentation/coding style violations introduced with r33783. Please take more care when accepting patches! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33787 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,18 +5,21 @@
|
|||||||
#ifndef _SCHED_H_
|
#ifndef _SCHED_H_
|
||||||
#define _SCHED_H_
|
#define _SCHED_H_
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SCHED_OTHER 1
|
|
||||||
#define SCHED_RR 2
|
#define SCHED_OTHER 1
|
||||||
#define SCHED_FIFO 4
|
#define SCHED_RR 2
|
||||||
|
#define SCHED_FIFO 4
|
||||||
|
|
||||||
struct sched_param {
|
struct sched_param {
|
||||||
int sched_priority;
|
int sched_priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern int sched_yield(void);
|
extern int sched_yield(void);
|
||||||
extern int sched_get_priority_min(int);
|
extern int sched_get_priority_min(int);
|
||||||
extern int sched_get_priority_max(int);
|
extern int sched_get_priority_max(int);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "pthread_private.h"
|
#include "pthread_private.h"
|
||||||
|
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
|
|
||||||
#include <thread_defs.h>
|
#include <thread_defs.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
pthread_attr_init(pthread_attr_t *_attr)
|
pthread_attr_init(pthread_attr_t *_attr)
|
||||||
{
|
{
|
||||||
@@ -134,25 +136,29 @@ pthread_attr_setscope(pthread_attr_t *attr, int contentionScope)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param)
|
pthread_attr_setschedparam(pthread_attr_t *attr,
|
||||||
|
const struct sched_param *param)
|
||||||
{
|
{
|
||||||
if (attr == NULL || param == NULL)
|
if (attr == NULL || param == NULL)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
(*attr)->sched_priority = param->sched_priority;
|
(*attr)->sched_priority = param->sched_priority;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param)
|
pthread_attr_getschedparam(const pthread_attr_t *attr,
|
||||||
|
struct sched_param *param)
|
||||||
{
|
{
|
||||||
if (attr == NULL || param == NULL)
|
if (attr == NULL || param == NULL)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
param->sched_priority = (*attr)->sched_priority;
|
param->sched_priority = (*attr)->sched_priority;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@ sched_get_priority_min(int policy)
|
|||||||
case SCHED_RR:
|
case SCHED_RR:
|
||||||
case SCHED_OTHER:
|
case SCHED_OTHER:
|
||||||
return B_LOW_PRIORITY;
|
return B_LOW_PRIORITY;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
@@ -42,7 +44,8 @@ sched_get_priority_max(int policy)
|
|||||||
case SCHED_FIFO:
|
case SCHED_FIFO:
|
||||||
case SCHED_RR:
|
case SCHED_RR:
|
||||||
case SCHED_OTHER:
|
case SCHED_OTHER:
|
||||||
return B_REAL_TIME_PRIORITY;
|
return B_URGENT_DISPLAY_PRIORITY;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user