source: rtems/testsuites/psxtests/psxhdrs/pthread/pthread_setschedparam.c @ 5247a214

5
Last change on this file since 5247a214 was b57a6a7, checked in by Joel Sherrill <joel.sherrill@…>, on 02/11/15 at 19:59:29

psxhdrs: Reorganize into subdirectories per .h file and rename files

This is a better organization and makes it clearer which file
is testing which method from which header file.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  This test file is used to verify that the header files associated with
3 *  invoking this function are correct.
4 *
5 *  COPYRIGHT (c) 1989-2009.
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.org/license/LICENSE.
11 */
12
13#ifdef HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <pthread.h>
18
19#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
20#error "RTEMS is supposed to have pthread_setschedparam"
21#endif
22
23int test( void );
24
25int test( void )
26{
27  pthread_t           thread = 0;
28  int                 policy;
29  struct sched_param  param;
30  int                 result;
31
32  policy = SCHED_OTHER;
33  policy = SCHED_FIFO;
34  policy = SCHED_RR;
35#ifdef _POSIX_SPORADIC_SERVER
36  policy = SCHED_SPORADIC;
37#endif
38
39  /*
40   *  really should use sched_get_priority_min() and sched_get_priority_max()
41   */
42
43  param.sched_priority = 0;
44#ifdef _POSIX_SPORADIC_SERVER
45  param.sched_ss_low_priority = 0;
46  param.sched_ss_repl_period.tv_sec = 0;
47  param.sched_ss_repl_period.tv_nsec = 0;
48  param.sched_ss_init_budget.tv_sec = 0;
49  param.sched_ss_init_budget.tv_nsec = 0;
50#endif
51
52  result = pthread_setschedparam( thread, policy, &param );
53
54  return result;
55}
Note: See TracBrowser for help on using the repository browser.