From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116386 invoked by alias); 22 Jul 2019 18:54:23 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 116376 invoked by uid 89); 22 Jul 2019 18:54:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_00,BODY_8BITS,GARBLED_BODY,SPF_HELO_PASS autolearn=no version=3.3.1 spammy=HX-Languages-Length:771, HContent-Transfer-Encoding:8bit X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Jul 2019 18:54:21 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A21E9C057F2E; Mon, 22 Jul 2019 18:54:20 +0000 (UTC) Received: from laptop.zalov.cz (ovpn-116-36.ams2.redhat.com [10.36.116.36]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E3671001B20; Mon, 22 Jul 2019 18:54:20 +0000 (UTC) Received: from laptop.zalov.cz (localhost [127.0.0.1]) by laptop.zalov.cz (8.15.2/8.15.2) with ESMTP id x6MIsHnQ017791; Mon, 22 Jul 2019 20:54:17 +0200 Received: (from jakub@localhost) by laptop.zalov.cz (8.15.2/8.15.2/Submit) id x6MIsD67017787; Mon, 22 Jul 2019 20:54:13 +0200 Date: Mon, 22 Jul 2019 18:54:00 -0000 From: Jakub Jelinek To: =?utf-8?B?6rmA6rec656Y?= Cc: gcc@gcc.gnu.org Subject: Re: Re: [GSoC'19, libgomp work-stealing] Task parallelism runtime Message-ID: <20190722185413.GA13123@laptop.zalov.cz> Reply-To: Jakub Jelinek References: <2ec486a9ba251a2ffc757ed3b06192@cweb004.nm.nfra.io> <20190713062848.GE2125@tucnak> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-IsSubscribed: yes X-SW-Source: 2019-07/txt/msg00154.txt.bz2 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