source: rtems/c/src/exec/posix/src/pthreadgetschedparam.c @ 8f4bddd9

4.104.114.84.95
Last change on this file since 8f4bddd9 was 8f4bddd9, checked in by Joel Sherrill <joel.sherrill@…>, on 12/19/00 at 16:42:15

2000-12-19 Joel Sherrill <joel@…>

  • src/pthreadgetschedparam.c: Do not set output parameters if the pointers are NULL.
  • 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-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      if ( policy )
44        *policy = api->schedpolicy;
45      if ( param ) {
46        *param  = api->schedparam;
47        param->sched_priority =
48          _POSIX_Priority_From_core( the_thread->current_priority );
49      }
50      _Thread_Enable_dispatch();
51      return 0;
52  }
53
54  return POSIX_BOTTOM_REACHED();
55
56}
Note: See TracBrowser for help on using the repository browser.