AuroraRuntime/Include/Aurora/IO/Async.hpp

35 lines
1.3 KiB
C++
Raw Normal View History

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Async.hpp
Date: 2022-5-13
Author: Reece
***/
#pragma once
namespace Aurora::IO
{
/**
* Waits for at least one overlapped IO event
* @param transactions An array mask of FIO transactions
* @param timeout Timeout in milliseconds, zero = indefinite
*/
AUKN_SYM AuUInt32 WaitMultiple(const AuList<AuSPtr<IAsyncTransaction>> &transactions, AuUInt32 timeoutMs);
AUKN_SYM AuList<AuSPtr<IAsyncTransaction>> WaitMultiple2(const AuList<AuSPtr<IAsyncTransaction>> &transactions, AuUInt32 timeoutMs);
/**
* A hint to dispatch any outstanding IO requests.
*
* The Aurora Runtime optimizes file FileRead/Writes by batching on some platforms.
* It may be required to call SendBatched for lower latency immediately after a Read/Write.
*
* Consider any call to WaitMultiple, internal loop source signal state, or loop queue wait,
* an internal hint to request an async IO work-queue flush.
*
* @warning This does nothing on NT
* @warning Linux StartRead/StartWrites will not start immediately.
* They instead wait for a yield or call to SendBatched, unless reconfigured under the RuntimeConfig struct.
*/
AUKN_SYM void SendBatched();
}