From patchwork Sat Aug 20 07:45:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 74358 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp659422qga; Sat, 20 Aug 2016 00:47:40 -0700 (PDT) X-Received: by 10.55.97.133 with SMTP id v127mr13441661qkb.59.1471679260750; Sat, 20 Aug 2016 00:47:40 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e63si7185853qkd.174.2016.08.20.00.47.40; Sat, 20 Aug 2016 00:47:40 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 6590361744; Sat, 20 Aug 2016 07:47:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 3687E617C8; Sat, 20 Aug 2016 07:46:24 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 6880961736; Sat, 20 Aug 2016 07:46:17 +0000 (UTC) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) by lists.linaro.org (Postfix) with ESMTPS id 53EA261705 for ; Sat, 20 Aug 2016 07:46:16 +0000 (UTC) Received: by mail-lf0-f44.google.com with SMTP id f93so46699423lfi.2 for ; Sat, 20 Aug 2016 00:46:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cVdXvtTEXFkLqfvawG3IKfStc3BS3SepfxO0oMDWjEo=; b=INsKf6EXi9IjoAVmNzmBD6oHjcgbwTzMZHYCq+IZxy8j6U/0CWLGV6a4c32SCi5B1d M3v1aYltsd6tMUmpeozfVvyVFrLRKLPClKD4nCCcFqthoYgZL7Hxm2K0wubc54dF+Lwq rwqsG7UDKM0Og64bPacpOomRdtnk5SbCjaFpHhmp8JuqND7c2SR7qm5GsJ4LBoOiglpX 50sm9ZYT8wO2Mu5QFieZ7chXYbtHVT8H2nIg4MBpCv5/4uh7/EZNcvThpJxvInvYFMpz zyN/snT+/srcz95ARZdbwNmNi1HQ7GzYNMtwcmvje2MjHwIfnku3tgZ+UaIGChHk9fVQ 1OAQ== X-Gm-Message-State: AEkoousvhcoVHPioh6nhSWlc6OhIoVJPnBBKV9Zn8njAC3mgWSW1T2vQwX++IlK++w0kBPrWFT8= X-Received: by 10.46.1.92 with SMTP id 89mr3029706ljb.21.1471679174974; Sat, 20 Aug 2016 00:46:14 -0700 (PDT) Received: from localhost.localdomain (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id 17sm1854092ljj.49.2016.08.20.00.46.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 20 Aug 2016 00:46:14 -0700 (PDT) From: Christophe Milard To: bill.fischofer@linaro.org, mike.holmes@linaro.org, lng-odp@lists.linaro.org Date: Sat, 20 Aug 2016 09:45:52 +0200 Message-Id: <1471679163-17240-3-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471679163-17240-1-git-send-email-christophe.milard@linaro.org> References: <1471679163-17240-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv3 02/13] drv: adding barrier.h X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Based on API interface file. Signed-off-by: Christophe Milard --- include/odp/drv/spec/barrier.h | 66 ++++++++++++++++++++++++++++++++++++++++++ platform/Makefile.inc | 1 + 2 files changed, 67 insertions(+) create mode 100644 include/odp/drv/spec/barrier.h -- 2.7.4 diff --git a/include/odp/drv/spec/barrier.h b/include/odp/drv/spec/barrier.h new file mode 100644 index 0000000..5ac65a3 --- /dev/null +++ b/include/odp/drv/spec/barrier.h @@ -0,0 +1,66 @@ +/* Copyright (c) 2016, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODPDRV execution barriers + */ + +#ifndef ODPDRV_API_BARRIER_H_ +#define ODPDRV_API_BARRIER_H_ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup odpdrv_barrier ODPDRV BARRIER + * Thread execution and memory ordering barriers. + * + * @details + * Thread execution barrier (odpdrv_barrier_t) + * + * Thread execution barrier synchronizes a group of threads to wait on the + * barrier until the entire group has reached the barrier. + * @{ + */ + +/** + * @typedef odpdrv_barrier_t + * ODPDRV thread synchronization barrier + */ + +/** + * Initialize barrier with thread count. + * + * @param barr Pointer to a barrier variable + * @param count Thread count + */ +void odpdrv_barrier_init(odpdrv_barrier_t *barr, int count); + +/** + * Synchronize thread execution on barrier. + * Wait for all threads to arrive at the barrier until they are let loose again. + * Threads will block (spin) until the last thread has arrived at the barrier. + * All memory operations before the odpdrv_barrier_wait() call will be visible + * to all threads when they leave the barrier. + * + * @param barr Pointer to a barrier variable + */ +void odpdrv_barrier_wait(odpdrv_barrier_t *barr); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#include +#endif diff --git a/platform/Makefile.inc b/platform/Makefile.inc index 079f34d..6ade6df 100644 --- a/platform/Makefile.inc +++ b/platform/Makefile.inc @@ -65,6 +65,7 @@ odpdrvspecincludedir= $(includedir)/odp/drv/spec odpdrvspecinclude_HEADERS = \ $(top_srcdir)/include/odp/drv/spec/align.h \ $(top_srcdir)/include/odp/drv/spec/atomic.h \ + $(top_srcdir)/include/odp/drv/spec/barrier.h \ $(top_srcdir)/include/odp/drv/spec/byteorder.h \ $(top_srcdir)/include/odp/drv/spec/compiler.h \ $(top_srcdir)/include/odp/drv/spec/spinlock.h \