summaryrefslogtreecommitdiff
path: root/libpthread/tests/test-12.c
blob: 2b784908f86724e5ba290c1e13c087cafed57091 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Test concurrency level.  */

#define _GNU_SOURCE

#include <pthread.h>
#include <assert.h>
#include <error.h>
#include <errno.h>

int
main (int argc, char **argv)
{
  int i;
  int err;

  i = pthread_getconcurrency ();
  assert (i == 0);

  err = pthread_setconcurrency (-1);
  assert (err == EINVAL);

  err = pthread_setconcurrency (4);
  assert (err == 0);

  i = pthread_getconcurrency ();
  assert (i == 4);

  return 0;
}