On Mon, May 17, 2021 at 04:48:03PM +0100, Kwok Cheung Yeung wrote: > 2021-05-17 Kwok Cheung Yeung <k...@codesourcery.com> > > libgomp/ > * task.c (omp_fulfill_event): Call gomp_team_barrier_set_task_pending > if new tasks generated. > * testsuite/libgomp.c-c++-common/task-detach-13.c: New. > --- > libgomp/task.c | 1 + > .../libgomp.c-c++-common/task-detach-13.c | 60 +++++++++++++++++++ > 2 files changed, 61 insertions(+) > create mode 100644 libgomp/testsuite/libgomp.c-c++-common/task-detach-13.c > > diff --git a/libgomp/task.c b/libgomp/task.c > index 1c73c759a8d..feb4796a3ac 100644 > --- a/libgomp/task.c > +++ b/libgomp/task.c > @@ -2460,6 +2460,7 @@ omp_fulfill_event (omp_event_handle_t event) > if (new_tasks > 0) > { > /* Wake up threads to run new tasks. */ > + gomp_team_barrier_set_task_pending (&team->barrier); > do_wake = team->nthreads - team->task_running_count; > if (do_wake > new_tasks) > do_wake = new_tasks; > diff --git a/libgomp/testsuite/libgomp.c-c++-common/task-detach-13.c > b/libgomp/testsuite/libgomp.c-c++-common/task-detach-13.c > new file mode 100644 > index 00000000000..4306524526d > --- /dev/null > +++ b/libgomp/testsuite/libgomp.c-c++-common/task-detach-13.c > @@ -0,0 +1,60 @@ > +/* { dg-do run } */ > +/* { dg-options "-fopenmp" } */
-fopenmp as dg-options is implicit, please remove it. > +/* { dg-timeout 10 } */ This will fail on targets that don't have pthreads. We have already some tests that do use pthread_create, and those currently use /* { dg-do run { target *-*-linux* *-*-gnu* *-*-freebsd* } } */ so I'd do the same for this test. There is also effective target pthread but am not sure if it covers everything we need to test. > + > + > + pthread_join (thr, 0); I'd add return 0; While we default to C17 which doesn't need it, we don't say anywhere in the testcase that it is C99+ or C++ only, so I think better make it valid C89 too. Otherwise LGTM, thanks. Jakub