> Yes, you can look up the definition. > gomp_ barrier_last_thread is just a bit in the state bitmask passed to the > routine, it is set on the last thread that encounters the barrier, which is > figured out by doing atomic subtraction from the counter.
I saw the implementation, just wanted to be sure that's the general case. Thanks. Ray Kim -----Original Message----- From: "Jakub Jelinek"<ja...@redhat.com> To: "김규래"<msc...@naver.com>; Cc: <gcc@gcc.gnu.org>; Sent: 2019-07-23 (화) 03:54:13 (GMT+09:00) Subject: Re: Re: [GSoC'19, libgomp work-stealing] Task parallelism runtime On Sun, Jul 21, 2019 at 04:46:33PM +0900, 김규래 wrote: > About the snippet below, > > if (gomp_barrier_last_thread (state)) > { > if (team->task_count == 0) > { > gomp_team_barrier_done (&team->barrier, state); > gomp_mutex_unlock (&team->task_lock); > gomp_team_barrier_wake (&team->barrier, 0); > return; > } > gomp_team_barrier_set_waiting_for_tasks (&team->barrier); > } > > Am I safe to assume that gomp_barrier_last_thread is thread-safe? Yes, you can look up the definition. gomp_ barrier_last_thread is just a bit in the state bitmask passed to the routine, it is set on the last thread that encounters the barrier, which is figured out by doing atomic subtraction from the counter. Jakub