+2020-03-25 Thomas Schwinge <thomas@codesourcery.com>
+
+ * oacc-init.c (acc_init_1): Move 'acc_init_state' logic to where
+ it belongs.
+
2019-11-22 Kwok Cheung Yeung <kcy@codesourcery.com>
* testsuite/libgomp.oacc-fortran/lib-16.f90: Fix async-safety issue.
static struct gomp_device_descr *
acc_init_1 (acc_device_t d, acc_construct_t parent_construct, int implicit)
{
+ gomp_mutex_lock (&acc_init_state_lock);
+ acc_init_state = initializing;
+ acc_init_thread = pthread_self ();
+ gomp_mutex_unlock (&acc_init_state_lock);
+
bool check_not_nested_p;
if (implicit)
{
struct gomp_device_descr *base_dev, *acc_dev;
int ndevs;
- gomp_mutex_lock (&acc_init_state_lock);
- acc_init_state = initializing;
- acc_init_thread = pthread_self ();
- gomp_mutex_unlock (&acc_init_state_lock);
-
base_dev = resolve_device (d, true);
ndevs = base_dev->get_num_devices_func ();