source: rtems/testsuites/psxtests/psxconcurrency01/init.c @ 9a4eca5

5
Last change on this file since 9a4eca5 was 8228548, checked in by Joel Sherrill <joel@…>, on 02/19/16 at 22:00:48

Add pthread_getconcurrency() and pthread_setconcurrency()

This is the very simple implementation specified by the Open Group
for implementations with 1:1 kernel thread to user thread mappings.

http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_getconcurrency.html

updates #2680.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 2016
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <pmacros.h>
15#include <pthread.h>
16#include <errno.h>
17
18const char rtems_test_name[] = "PSXCONCURRENCY01";
19
20/* forward declarations to avoid warnings */
21void *POSIX_Init(void *argument);
22
23void *POSIX_Init(
24  void *argument
25)
26{
27  int  sc;
28
29  TEST_BEGIN();
30
31  puts( "Init: pthread_getconcurrency - initial value of 0" );
32  sc = pthread_getconcurrency();
33  rtems_test_assert( sc == 0 );
34
35  puts( "Init: pthread_setconcurrency - set value to 2" );
36  sc = pthread_setconcurrency( 2 );
37  rtems_test_assert( sc == 0 );
38
39  puts( "Init: pthread_getconcurrency - confirm new value of 2" );
40  sc = pthread_getconcurrency();
41  rtems_test_assert( sc == 2 );
42
43  TEST_END();
44  rtems_test_exit(0);
45}
46
47
48/* configuration information */
49#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
50#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
51
52#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
53
54#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
55#define CONFIGURE_POSIX_INIT_THREAD_TABLE
56
57#define CONFIGURE_INIT
58#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.