gcc/libitm/testsuite/libitm.c/simple-2.c
Rainer Orth 8851b42977 libitm port to Tru64 UNIX
* config/alpha/sjlj.S (_ITM_beginTransaction) [!__ELF__]: Don't use
	.hidden.
	(.note.GNU-stack): Only use if __linux__.
	* alloc_cpp.cc [!__osf__] (_ZnaXRKSt9nothrow_t): Dummy function.
	* testsuite/libitm.c/notx.c: Use dg-options "-pthread".
	* testsuite/libitm.c/reentrant.c: Likewise.
	* testsuite/libitm.c/simple-2.c: Likewise.
	* testsuite/libitm.c/txrelease.c: Likewise.
	* testsuite/libitm.c++/static_ctor.C: Likewise.

From-SVN: r181262
2011-11-10 17:15:33 +00:00

32 lines
499 B
C

/* Simplest test involving real threads. Verify we get the correct answer. */
/* { dg-options "-pthread" } */
#include <stdlib.h>
#include <pthread.h>
static int x;
static void *start (void *dummy __attribute__((unused)))
{
__transaction_atomic { x++; }
return NULL;
}
int main()
{
pthread_t p[10];
int i;
for (i = 0; i < 10; ++i)
pthread_create (p+i, NULL, start, NULL);
for (i = 0; i < 10; ++i)
pthread_join (p[i], NULL);
if (x != 10)
abort ();
return 0;
}