Back to index

glibc  2.9
Defines | Functions
tst-basic5.c File Reference
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

int do_test (void)

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 73 of file tst-basic5.c.


Function Documentation

int do_test ( void  )

Definition at line 28 of file tst-basic5.c.

{
  int c = pthread_getconcurrency ();
  if (c != 0)
    {
      puts ("initial concurrencylevel wrong");
      exit (1);
    }

  if (pthread_setconcurrency (1) != 0)
    {
      puts ("setconcurrency failed");
      exit (1);
    }

  c = pthread_getconcurrency ();
  if (c != 1)
    {
      puts ("getconcurrency didn't return the value previous set");
      exit (1);
    }

  int e = pthread_setconcurrency (-1);
  if (e == 0)
    {
      puts ("setconcurrency of negative value didn't failed");
      exit (1);
    }
  if (e != EINVAL)
    {
      puts ("setconcurrency didn't return EINVAL for negative value");
      exit (1);
    }

  c = pthread_getconcurrency ();
  if (c != 1)
    {
      puts ("invalid getconcurrency changed level");
      exit (1);
    }

  return 0;
}

Here is the call graph for this function: