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

Reply via email to