OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libitm/] [testsuite/] [libitm.c/] [simple-2.c] - Blame information for rev 745

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 737 jeremybenn
/* Simplest test involving real threads.  Verify we get the correct answer.  */
2
 
3
/* { dg-options "-pthread" } */
4
 
5
#include <stdlib.h>
6
#include <pthread.h>
7
 
8
static int x;
9
 
10
static void *start (void *dummy __attribute__((unused)))
11
{
12
  __transaction_atomic { x++; }
13
  return NULL;
14
}
15
 
16
int main()
17
{
18
  pthread_t p[10];
19
  int i;
20
 
21
  for (i = 0; i < 10; ++i)
22
    pthread_create (p+i, NULL, start, NULL);
23
 
24
  for (i = 0; i < 10; ++i)
25
    pthread_join  (p[i], NULL);
26
 
27
  if (x != 10)
28
    abort ();
29
 
30
  return 0;
31
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.