source: rtems/cpukit/posix/src/pthreadgetschedparam.c @ 97b6dc0

4.10
Last change on this file since 97b6dc0 was 97b6dc0, checked in by Joel Sherrill <joel.sherrill@…>, on 03/08/11 at 22:14:56

2011-03-08 Joel Sherrill <joel.sherrilL@…>

PR 1759/cpukit

  • posix/src/cancel.c, posix/src/pthreaddetach.c, posix/src/pthreadequal.c, posix/src/pthreadgetschedparam.c, posix/src/pthreadjoin.c, posix/src/pthreadkill.c, posix/src/pthreadsetschedparam.c: Some POSIX pthread services did not support using Classic API Task Ids.
  • 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-2007.
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.rtems.com/license/LICENSE.
11 *
12 *  $Id$
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
26int 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 = _Thread_Get( thread, &location );
40  switch ( location ) {
41
42    case OBJECTS_LOCAL:
43      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
44      if ( policy )
45        *policy = api->schedpolicy;
46      if ( param ) {
47        *param  = api->schedparam;
48        param->sched_priority =
49          _POSIX_Priority_From_core( the_thread->current_priority );
50      }
51      _Thread_Enable_dispatch();
52      return 0;
53
54#if defined(RTEMS_MULTIPROCESSING)
55    case OBJECTS_REMOTE:
56#endif
57    case OBJECTS_ERROR:
58      break;
59  }
60
61  return ESRCH;
62
63}
Note: See TracBrowser for help on using the repository browser.