From c39414002f0f17ff984bcb84e1dcfb3178f0e04a Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 5 Sep 2009 01:16:56 +0000 Subject: [PATCH] Give an IORequest user the possibility to suppress child finish notifications. This allows for synchronous uses where subrequests are forked off and waited on. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32936 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/device_manager/IORequest.cpp | 12 ++++++++++-- src/system/kernel/device_manager/IORequest.h | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/device_manager/IORequest.cpp b/src/system/kernel/device_manager/IORequest.cpp index fef0fa7914..985e70f3db 100644 --- a/src/system/kernel/device_manager/IORequest.cpp +++ b/src/system/kernel/device_manager/IORequest.cpp @@ -653,7 +653,8 @@ IORequest::Init(off_t offset, size_t firstVecOffset, const iovec* vecs, fTeam = thread->team->id; fThread = thread->id; fIsWrite = write; - fPartialTransfer = 0; + fPartialTransfer = false; + fSuppressChildNotifications = false; // these are for iteration fVecIndex = 0; @@ -936,7 +937,7 @@ IORequest::SubRequestFinished(IORequest* request, status_t status, if (status != B_OK && fStatus == 1) fStatus = status; - if (--fPendingChildren > 0) + if (--fPendingChildren > 0 || fSuppressChildNotifications) return; // last child finished @@ -972,6 +973,13 @@ IORequest::SetTransferredBytes(bool partialTransfer, size_t transferredBytes) } +void +IORequest::SetSuppressChildNotifications(bool suppress) +{ + fSuppressChildNotifications = suppress; +} + + void IORequest::Advance(size_t bySize) { diff --git a/src/system/kernel/device_manager/IORequest.h b/src/system/kernel/device_manager/IORequest.h index 41f5ee42cd..6df985d399 100644 --- a/src/system/kernel/device_manager/IORequest.h +++ b/src/system/kernel/device_manager/IORequest.h @@ -264,6 +264,10 @@ struct IORequest : IORequestChunk, DoublyLinkedListLinkImpl { void SetTransferredBytes(bool partialTransfer, size_t transferredBytes); + void SetSuppressChildNotifications(bool suppress); + bool SuppressChildNotifications() const + { return fSuppressChildNotifications; } + bool IsWrite() const { return fIsWrite; } bool IsRead() const { return !fIsWrite; } team_id Team() const { return fTeam; } @@ -325,6 +329,7 @@ private: thread_id fThread; bool fIsWrite; bool fPartialTransfer; + bool fSuppressChildNotifications; io_request_finished_callback fFinishedCallback; void* fFinishedCookie;