source: rtems/cpukit/posix/src/pthreadgetschedparam.c @ f42b726

4.104.114.84.95
Last change on this file since f42b726 was f42b726, checked in by Joel Sherrill <joel.sherrill@…>, on 01/24/01 at 14:17:28

2001-01-24 Ralf Corsepius <corsepiu@…>

  • configure.in: Add src/config.h
  • src/Makefile.am: Add INCLUDES += -I. to pickup config.h
  • src/.cvsignore: Add config.h and stamp-h
  • src/*.c: Add config.h support.
  • 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#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 = _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}
Note: See TracBrowser for help on using the repository browser.