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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libitm/] [testsuite/] [libitm.c/] [notx.c] - Blame information for rev 737

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 737 jeremybenn
/* These tests all check whether initialization happens properly even if no
2
   transaction has been used in the current thread yet.  */
3
 
4
/* { dg-options "-pthread" } */
5
 
6
#include <stdlib.h>
7
#include <pthread.h>
8
#include <libitm.h>
9
 
10
static void *test1 (void *dummy __attribute__((unused)))
11
{
12
  if (_ITM_inTransaction() != outsideTransaction)
13
    abort();
14
  return NULL;
15
}
16
 
17
static void *test2 (void *dummy __attribute__((unused)))
18
{
19
  if (_ITM_getTransactionId() != _ITM_noTransactionId)
20
    abort();
21
  return NULL;
22
}
23
 
24
 
25
int main()
26
{
27
  pthread_t thread;
28
 
29
  pthread_create(&thread, NULL, test1, NULL);
30
  pthread_join(thread, NULL);
31
 
32
  pthread_create(&thread, NULL, test2, NULL);
33
  pthread_join(thread, NULL);
34
 
35
  return 0;
36
}

powered by: WebSVN 2.1.0

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