AsyncWriteItem

Engine/source/platform/threads/threadPoolAsyncIO.h

Work item for writing to an output stream.

More...

Public Types

Parent::BufferType
BufferType 
Parent::OffsetType
OffsetType 
Parent 
Parent::StreamType
StreamType 
Parent::ValueType
ValueType 

Protected Attributes

void *

Handle of asynchronous write operation, if the stream implements IAsyncOutputStream.

Public Functions

AsyncWriteItem(StreamType * stream, U32 numElements, OffsetType offsetInStream, BufferType & buffer, bool takeOwnershipOfBuffer, U32 offsetInBuffer, ThreadContext * context)

Protected Functions

_prep(StreamType * stream)
_write(IOutputStream< T > * stream)

Execute the actions associated with this work item.

Detailed Description

Work item for writing to an output stream.

The stream being written to may implement any of the given output stream interfaces. Preference is given to IAsyncOutputStream, then to IOffsetOutputStream, and only if none of these is implemented IOutputStream is used.

A useful feature is to yield ownership of the data buffer to the write item. This way, this can be pretty much used in a fire-and-forget manner where after submission, no further synchronization happens between the client and the work item.

note:

Be aware that if writing to an output stream that has an implicit position property, multiple concurrent writes will interfere with each other.

Public Types

typedef Parent::BufferType BufferType 
typedef Parent::OffsetType OffsetType 
typedef AsyncIOItem< T, Stream > Parent 
typedef Parent::StreamType StreamType 
typedef Parent::ValueType ValueType 

Protected Attributes

void * mAsyncHandle 

Handle of asynchronous write operation, if the stream implements IAsyncOutputStream.

Public Functions

AsyncWriteItem(StreamType * stream, U32 numElements, OffsetType offsetInStream, BufferType & buffer, bool takeOwnershipOfBuffer, U32 offsetInBuffer, ThreadContext * context)

Protected Functions

_prep(StreamType * stream)

_write(IAsyncOutputStream< T > * stream)

_write(IOffsetOutputStream< T > * stream)

_write(IOutputStream< T > * stream)

execute()

Reimplemented from: ThreadPool::WorkItem