Back to index

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

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

static void once_handler (void)
static int do_test (void)

Variables

static pthread_once_t once = PTHREAD_ONCE_INIT
static int global

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 50 of file tst-once1.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 36 of file tst-once1.c.

{
  pthread_once (&once, once_handler);
  pthread_once (&once, once_handler);

  if (global != 1)
    {
      printf ("global = %d, expected 1\n", global);
      return 1;
    }

  return 0;
}

Here is the call graph for this function:

static void once_handler ( void  ) [static]

Definition at line 29 of file tst-once1.c.

{
  ++global;
}

Here is the caller graph for this function:


Variable Documentation

int global [static]

Definition at line 26 of file tst-once1.c.

Definition at line 24 of file tst-once1.c.