summaryrefslogtreecommitdiff
path: root/sched.c
blob: b4cbc0d3d3b646d004612fc44a8d1d0d63e1bc9f (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
/*
 * sched.c
 * 
 * Description:
 * POSIX thread functions that deal with thread scheduling.
 */

#include "pthread.h"

int
pthread_attr_setschedparam(pthread_attr_t *attr,
			   const struct sched_param *param)
{
  if (is_attr(attr) != 0 || param == NULL)
    {
      return EINVAL;
    }

  attr->priority = param->sched_priority;
  return 0;
}

int pthread_attr_getschedparam(const pthread_attr_t *attr,
			       struct sched_param *param)
{
  if (is_attr(attr) != 0 || param == NULL)
    {
      return EINVAL;
    }
  
  param->sched_priority = attr->priority;
  return 0;
}

int sched_get_priority_max(int policy)
{
  /* This is independent of scheduling policy in Win32. */
  return THREAD_PRIORITY_HIGHEST;
}

int sched_get_priority_min(int policy)
{
  /* This is independent of scheduling policy in Win32. */
  return THREAD_PRIORITY_LOWEST;
}