source: rtems/c/src/exec/posix/src/pthreadgetschedparam.c @ 5f57730

4.104.114.84.95
Last change on this file since 5f57730 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
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 *  $Id$
13 */
14
15
16#include <pthread.h>
17#include <errno.h>
18
19#include <rtems/system.h>
20#include <rtems/posix/pthread.h>
21#include <rtems/posix/priority.h>
22
23int pthread_getschedparam(
24  pthread_t           thread,
25  int                *policy,
26  struct sched_param *param
27)
28{
29  Objects_Locations        location;
30  POSIX_API_Control       *api;
31  register Thread_Control *the_thread;
32
33  if ( !policy || !param  )
34    return EINVAL;
35
36  the_thread = _POSIX_Threads_Get( thread, &location );
37  switch ( location ) {
38    case OBJECTS_ERROR:
39    case OBJECTS_REMOTE:
40      return ESRCH;
41    case OBJECTS_LOCAL:
42      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
43      *policy = api->schedpolicy;
44      *param  = api->schedparam;
45      param->sched_priority =
46        _POSIX_Priority_From_core( the_thread->current_priority );
47      _Thread_Enable_dispatch();
48      return 0;
49  }
50
51  return POSIX_BOTTOM_REACHED();
52
53}
Note: See TracBrowser for help on using the repository browser.