aboutsummaryrefslogtreecommitdiff
path: root/libgomp/task.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/task.c')
-rw-r--r--libgomp/task.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/libgomp/task.c b/libgomp/task.c
index 30cd046..a7e67e8 100644
--- a/libgomp/task.c
+++ b/libgomp/task.c
@@ -2465,6 +2465,7 @@ gomp_create_artificial_team (void)
struct gomp_task_icv *icv;
struct gomp_team *team = gomp_new_team (1);
struct gomp_task *task = thr->task;
+ struct gomp_task **implicit_task = &task;
icv = task ? &task->icv : &gomp_global_icv;
team->prev_ts = thr->ts;
thr->ts.team = team;
@@ -2477,17 +2478,25 @@ gomp_create_artificial_team (void)
thr->ts.static_trip = 0;
thr->task = &team->implicit_task[0];
gomp_init_task (thr->task, NULL, icv);
- if (task)
+ while (*implicit_task
+ && (*implicit_task)->kind != GOMP_TASK_IMPLICIT)
+ implicit_task = &(*implicit_task)->parent;
+ if (*implicit_task)
{
- thr->task = task;
+ thr->task = *implicit_task;
gomp_end_task ();
- free (task);
+ free (*implicit_task);
thr->task = &team->implicit_task[0];
}
#ifdef LIBGOMP_USE_PTHREADS
else
pthread_setspecific (gomp_thread_destructor, thr);
#endif
+ if (implicit_task != &task)
+ {
+ *implicit_task = thr->task;
+ thr->task = task;
+ }
}
/* The format of data is:
@@ -2678,6 +2687,16 @@ omp_in_final (void)
ialias (omp_in_final)
+int
+omp_in_explicit_task (void)
+{
+ struct gomp_thread *thr = gomp_thread ();
+ struct gomp_task *task = thr->task;
+ return task && task->kind != GOMP_TASK_IMPLICIT;
+}
+
+ialias (omp_in_explicit_task)
+
void
omp_fulfill_event (omp_event_handle_t event)
{