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:
@@ -653,7 +653,8 @@ IORequest::Init(off_t offset, size_t firstVecOffset, const iovec* vecs,
|
|||||||
fTeam = thread->team->id;
|
fTeam = thread->team->id;
|
||||||
fThread = thread->id;
|
fThread = thread->id;
|
||||||
fIsWrite = write;
|
fIsWrite = write;
|
||||||
fPartialTransfer = 0;
|
fPartialTransfer = false;
|
||||||
|
fSuppressChildNotifications = false;
|
||||||
|
|
||||||
// these are for iteration
|
// these are for iteration
|
||||||
fVecIndex = 0;
|
fVecIndex = 0;
|
||||||
@@ -936,7 +937,7 @@ IORequest::SubRequestFinished(IORequest* request, status_t status,
|
|||||||
if (status != B_OK && fStatus == 1)
|
if (status != B_OK && fStatus == 1)
|
||||||
fStatus = status;
|
fStatus = status;
|
||||||
|
|
||||||
if (--fPendingChildren > 0)
|
if (--fPendingChildren > 0 || fSuppressChildNotifications)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// last child finished
|
// last child finished
|
||||||
@@ -972,6 +973,13 @@ IORequest::SetTransferredBytes(bool partialTransfer, size_t transferredBytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
IORequest::SetSuppressChildNotifications(bool suppress)
|
||||||
|
{
|
||||||
|
fSuppressChildNotifications = suppress;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
IORequest::Advance(size_t bySize)
|
IORequest::Advance(size_t bySize)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -264,6 +264,10 @@ struct IORequest : IORequestChunk, DoublyLinkedListLinkImpl<IORequest> {
|
|||||||
void SetTransferredBytes(bool partialTransfer,
|
void SetTransferredBytes(bool partialTransfer,
|
||||||
size_t transferredBytes);
|
size_t transferredBytes);
|
||||||
|
|
||||||
|
void SetSuppressChildNotifications(bool suppress);
|
||||||
|
bool SuppressChildNotifications() const
|
||||||
|
{ return fSuppressChildNotifications; }
|
||||||
|
|
||||||
bool IsWrite() const { return fIsWrite; }
|
bool IsWrite() const { return fIsWrite; }
|
||||||
bool IsRead() const { return !fIsWrite; }
|
bool IsRead() const { return !fIsWrite; }
|
||||||
team_id Team() const { return fTeam; }
|
team_id Team() const { return fTeam; }
|
||||||
@@ -325,6 +329,7 @@ private:
|
|||||||
thread_id fThread;
|
thread_id fThread;
|
||||||
bool fIsWrite;
|
bool fIsWrite;
|
||||||
bool fPartialTransfer;
|
bool fPartialTransfer;
|
||||||
|
bool fSuppressChildNotifications;
|
||||||
|
|
||||||
io_request_finished_callback fFinishedCallback;
|
io_request_finished_callback fFinishedCallback;
|
||||||
void* fFinishedCookie;
|
void* fFinishedCookie;
|
||||||
|
|||||||
Reference in New Issue
Block a user