source: rtems/cpukit/posix/src/pthreadgetschedparam.c @ 2d2352b

4.115
Last change on this file since 2d2352b was 2d2352b, checked in by Sebastian Huber <sebastian.huber@…>, on 06/05/13 at 09:48:57

score: Add and use _Objects_Put()

Add and use _Objects_Put_without_thread_dispatch(). These two functions
pair with the _Objects_Get() function. This helps to introduce object
specific SMP locks to avoid lock contention.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief Gets Scheduling Policy and Parameters of Individual Threads
5 * @ingroup POSIXAPI
6 */
7
8/*
9 *  13.5.2 Dynamic Thread Scheduling Parameters Access,
10 *         P1003.1c/Draft 10, p. 124
11 *
12 *  COPYRIGHT (c) 1989-2007.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.com/license/LICENSE.
18 */
19
20#if HAVE_CONFIG_H
21#include "config.h"
22#endif
23
24#include <pthread.h>
25#include <errno.h>
26
27#include <rtems/system.h>
28#include <rtems/posix/pthread.h>
29#include <rtems/posix/priority.h>
30
31int pthread_getschedparam(
32  pthread_t           thread,
33  int                *policy,
34  struct sched_param *param
35)
36{
37  Objects_Locations        location;
38  POSIX_API_Control       *api;
39  register Thread_Control *the_thread;
40
41  if ( !policy || !param  )
42    return EINVAL;
43
44  the_thread = _Thread_Get( thread, &location );
45  switch ( location ) {
46
47    case OBJECTS_LOCAL:
48      api = the_thread->API_Extensions[ THREAD_API_POSIX ];
49      if ( policy )
50        *policy = api->schedpolicy;
51      if ( param ) {
52        *param  = api->schedparam;
53        param->sched_priority =
54          _POSIX_Priority_From_core( the_thread->current_priority );
55      }
56      _Objects_Put( &the_thread->Object );
57      return 0;
58
59#if defined(RTEMS_MULTIPROCESSING)
60    case OBJECTS_REMOTE:
61#endif
62    case OBJECTS_ERROR:
63      break;
64  }
65
66  return ESRCH;
67
68}
Note: See TracBrowser for help on using the repository browser.