From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtcKF-0000L4-In for qemu-devel@nongnu.org; Tue, 03 Nov 2015 09:12:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtcKE-0007dl-SF for qemu-devel@nongnu.org; Tue, 03 Nov 2015 09:12:39 -0500 From: "Denis V. Lunev" Date: Tue, 3 Nov 2015 17:12:12 +0300 Message-Id: <1446559933-28965-10-git-send-email-den@openvz.org> In-Reply-To: <1446559933-28965-1-git-send-email-den@openvz.org> References: <1446559933-28965-1-git-send-email-den@openvz.org> Subject: [Qemu-devel] [PATCH 09/10] aio_context: create aio_context_is_owner helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Denis V. Lunev" , Paolo Bonzini , qemu-devel@nongnu.org, Stefan Hajnoczi , qemu-stable@nongnu.org This helper is necessary to ensure locking constraints. Signed-off-by: Denis V. Lunev CC: Stefan Hajnoczi CC: Paolo Bonzini --- async.c | 5 +++++ include/block/aio.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/async.c b/async.c index bdc64a3..1d18d98 100644 --- a/async.c +++ b/async.c @@ -361,3 +361,8 @@ void aio_context_release(AioContext *ctx) { rfifolock_unlock(&ctx->lock); } + +bool aio_context_is_owner(AioContext *ctx) +{ + return rfifolock_is_owner(&ctx->lock); +} diff --git a/include/block/aio.h b/include/block/aio.h index bcc7d43..d8cd41a 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -166,6 +166,9 @@ void aio_context_acquire(AioContext *ctx); /* Relinquish ownership of the AioContext. */ void aio_context_release(AioContext *ctx); +/* Check that AioContext is owned by the current thread. */ +bool aio_context_is_owner(AioContext *ctx); + /** * aio_bh_new: Allocate a new bottom half structure. * -- 2.5.0