Back to index

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

Go to the source code of this file.


#define TEST_FUNCTION   do_test ()


static int do_test (void)

Define Documentation


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

#define TEST_FUNCTION   do_test ()

Definition at line 54 of file tst-spin3.c.

Function Documentation

static int do_test ( void  ) [static]

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

  pthread_spinlock_t s;

  if (pthread_spin_init (&s, PTHREAD_PROCESS_PRIVATE) != 0)
      puts ("spin_init failed");
      return 1;

  if (pthread_spin_lock (&s) != 0)
      puts ("1st spin_lock failed");
      return 1;

  /* Set an alarm for 1 second.  The wrapper will expect this.  */
  alarm (1);

  /* This call should never return.  */
  pthread_spin_lock (&s);

  puts ("2nd spin_lock returned");
  return 1;

Here is the call graph for this function: