OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [pthreadgetschedparam.c] - Blame information for rev 532

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: pthreadgetschedparam.c,v 1.2 2001-09-27 11:59:17 chris Exp $
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
 
23
int 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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.