source: rtems/cpukit/posix/src/pthreadconcurrency.c @ 77fbbd6

5
Last change on this file since 77fbbd6 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: 893 bytes
Line 
1#if HAVE_CONFIG_H
2#include "config.h"
3#endif
4
5/**
6 * @file
7 *
8 * @brief Pthread Get/Set Concurrency
9 * @ingroup POSIXAPI
10 *
11 * Per the Open Group specification, when user pthreads are mapped 1:1
12 * onto kernel threads, the implementation simply tracks an internal
13 * variable whose initial value is 0. If it is set, subsequent calls to
14 * obtain the value return that previously set.
15 */
16
17/*
18 *  COPYRIGHT (c) 2016.
19 *  On-Line Applications Research Corporation (OAR).
20 *
21 *  The license and distribution terms for this file may be
22 *  found in the file LICENSE in this distribution or at
23 *  http://www.rtems.org/license/LICENSE.
24 */
25
26#include <pthread.h>
27#include <errno.h>
28
29static int pthread_concurrency_level;
30
31int pthread_getconcurrency(void)
32{
33  return pthread_concurrency_level;
34}
35
36int pthread_setconcurrency(
37  int new_level
38)
39{
40  pthread_concurrency_level = new_level;
41  return 0;
42}
Note: See TracBrowser for help on using the repository browser.