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
This commit is contained in:
Michael Lotz
2009-09-05 01:16:56 +00:00
parent c24f6c7b06
commit c39414002f
2 changed files with 15 additions and 2 deletions
+10 -2
View File
@@ -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)
{
@@ -264,6 +264,10 @@ struct IORequest : IORequestChunk, DoublyLinkedListLinkImpl<IORequest> {
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;