OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [posix/] [src/] [pthreadgetschedparam.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
2
 *  13.5.2 Dynamic Thread Scheduling Parameters Access,
3
 *         P1003.1c/Draft 10, p. 124
4
 *
5
 *  COPYRIGHT (c) 1989-1999.
6
 *  On-Line Applications Research Corporation (OAR).
7
 *
8
 *  The license and distribution terms for this file may be
9
 *  found in the file LICENSE in this distribution or at
10
 *  http://www.OARcorp.com/rtems/license.html.
11
 *
12
 *  pthreadgetschedparam.c,v 1.5 2001/01/24 14:17:28 joel Exp
13
 */
14
 
15
#if HAVE_CONFIG_H
16
#include "config.h"
17
#endif
18
 
19
#include <pthread.h>
20
#include <errno.h>
21
 
22
#include <rtems/system.h>
23
#include <rtems/posix/pthread.h>
24
#include <rtems/posix/priority.h>
25
 
26
int pthread_getschedparam(
27
  pthread_t           thread,
28
  int                *policy,
29
  struct sched_param *param
30
)
31
{
32
  Objects_Locations        location;
33
  POSIX_API_Control       *api;
34
  register Thread_Control *the_thread;
35
 
36
  if ( !policy || !param  )
37
    return EINVAL;
38
 
39
  the_thread = _POSIX_Threads_Get( thread, &location );
40
  switch ( location ) {
41
    case OBJECTS_ERROR:
42
    case OBJECTS_REMOTE:
43
      return ESRCH;
44
    case OBJECTS_LOCAL:
45
      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
46
      if ( policy )
47
        *policy = api->schedpolicy;
48
      if ( param ) {
49
        *param  = api->schedparam;
50
        param->sched_priority =
51
          _POSIX_Priority_From_core( the_thread->current_priority );
52
      }
53
      _Thread_Enable_dispatch();
54
      return 0;
55
  }
56
 
57
  return POSIX_BOTTOM_REACHED();
58
 
59
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.