2 /* { dg-options "-pthread" } */
4 /* Tests that new transactions can be started from both transaction_pure and
5 transaction_unsafe code. This also requires proper handling of reentrant
6 nesting in the serial_lock implementation. */
14 int __attribute__((transaction_pure
)) pure(int i
)
16 __transaction_atomic
{
19 if (_ITM_inTransaction() == outsideTransaction
)
24 int __attribute__((transaction_unsafe
)) unsafe(int i
)
26 if (_ITM_inTransaction() != inIrrevocableTransaction
)
28 __transaction_atomic
{
31 if (_ITM_inTransaction() != inIrrevocableTransaction
)
36 static void *thread (void *dummy
__attribute__((unused
)))
38 __transaction_atomic
{
41 __transaction_relaxed
{
52 __transaction_atomic
{
55 __transaction_relaxed
{
61 // Spawn a new thread to check that the serial lock is not held.
62 pthread_create(&pt
, NULL
, thread
, NULL
);
63 pthread_join(pt
, NULL
);