Back to index

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

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

static void * tf (void *a)
int do_test (void)

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 81 of file tst-stdio2.c.


Function Documentation

int do_test ( void  )

Definition at line 53 of file tst-stdio2.c.

{
  pthread_t th;

  if (pthread_create (&th, NULL, tf, NULL) != 0)
    {
      write (2, "create failed\n", 14);
      _exit (1);
    }

  void *result;
  if (pthread_join (th, &result) != 0)
    {
      puts ("join failed");
      exit (1);
    }
  else if (result != NULL)
    {
      printf ("wrong return value: %p, expected %p\n", result, NULL);
      exit (1);
    }

  puts ("join returned succsefully");

  return 0;
}

Here is the call graph for this function:

static void* tf ( void *  a) [static]

Definition at line 27 of file tst-stdio2.c.

{
  puts ("start tf");

  /* Multiple locking, implicitly or explicitly, must be possible.  */
  flockfile (stdout);

  puts ("after first flockfile");

  flockfile (stdout);

  puts ("foo");

  funlockfile (stdout);

  puts ("after first funlockfile");

  funlockfile (stdout);

  puts ("all done");

  return a;
}

Here is the call graph for this function: