source: rtems/cpukit/posix/src/pthreadgetschedparam.c @ 811fae1

4.104.114.84.95
Last change on this file since 811fae1 was d90df9aa, checked in by Joel Sherrill <joel.sherrill@…>, on 01/26/99 at 16:00:04

Added include of <rtems/posix/priority.h> so a macro would expand
and eliminate a link error.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  13.5.2 Dynamic Thread Scheduling Parameters Access,
3 *         P1003.1c/Draft 10, p. 124
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16
17#include <pthread.h>
18#include <errno.h>
19
20#include <rtems/system.h>
21#include <rtems/posix/pthread.h>
22#include <rtems/posix/priority.h>
23
24int pthread_getschedparam(
25  pthread_t           thread,
26  int                *policy,
27  struct sched_param *param
28)
29{
30  Objects_Locations        location;
31  POSIX_API_Control       *api;
32  register Thread_Control *the_thread;
33
34  if ( !policy || !param  )
35    return EINVAL;
36
37  the_thread = _POSIX_Threads_Get( thread, &location );
38  switch ( location ) {
39    case OBJECTS_ERROR:
40    case OBJECTS_REMOTE:
41      return ESRCH;
42    case OBJECTS_LOCAL:
43      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
44      *policy = api->schedpolicy;
45      *param  = api->schedparam;
46      param->sched_priority =
47        _POSIX_Priority_From_core( the_thread->current_priority );
48      _Thread_Enable_dispatch();
49      return 0;
50  }
51
52  return POSIX_BOTTOM_REACHED();
53
54}
Note: See TracBrowser for help on using the repository browser.