[+] Add IOSleep, IOYieldFor utility functions

[*] Add/clean up header comments
This commit is contained in:
Reece Wilson 2022-08-05 11:28:34 +01:00
parent a1e479e28e
commit 0a66e6741b
4 changed files with 81 additions and 0 deletions

View File

@ -32,6 +32,27 @@ namespace Aurora::Compression
AuFunction<bool(AuUInt, AuUInt)> reportProgress;
};
/**
* @deprecated legacy api / wont remove
*
* This API class is still viable for single-threaded utilities wishing to compress once
* Consider it a utility in addition to the main StreamProcessor class of APIs.
*
* It is still tested and supported as a non-muxable pipe operation w/o the overhead
* (and features of) the io subsystem.
*
*/
AUKN_SYM bool Decompress(const CompressionPipe &stream, const DecompressInfo &meta);
/**
* @deprecated legacy api / wont remove
*
* This API class is still viable for single-threaded utilities wishing to compress once
* Consider it a utility in addition to the main StreamProcessor class of APIs.
*
* It is still tested and supported as a non-muxable pipe operation w/o the overhead
* (and features of) the io subsystem.
*
*/
AUKN_SYM bool Compress(const CompressionPipe &stream, const CompressionInfo &info);
}

View File

@ -11,10 +11,35 @@ namespace Aurora::IO
{
/**
* Waits for at least one overlapped IO event
*
* @param timeout Timeout in milliseconds, zero = indefinite
* @return true on preemption, false on timeout
*/
AUKN_SYM bool WaitFor(AuUInt32 milliseconds, bool waitEntireFrame = true);
/**
* Sleeps for the given timeout in milliseconds
* Equivalent to WaitFor(timeout, true)
*
* @param timeout Timeout in milliseconds, zero = indefinite
* @return True if an IO event occurred
*/
AUKN_SYM bool IOSleep(AuUInt32 milliseconds);
/**
* Sleeps up to the given timeout in milliseconds
* Equivalent to WaitFor(timeout, false)
*
* @param timeout Timeout in milliseconds, zero = indefinite
* @return True if an IO event occurred
*/
AUKN_SYM bool IOYieldFor(AuUInt32 milliseconds);
/**
* Nonblocking yield for IO alerts
*
* @param timeout Timeout in milliseconds, zero = indefinite
* @return True if an IO event occurred
*/
AUKN_SYM bool IOYield();
}

23
Source/IO/IOSleep.cpp Executable file
View File

@ -0,0 +1,23 @@
/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: IOSleep.cpp
Date: 2022-8-5
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "IO.hpp"
#include "IOSleep.hpp"
namespace Aurora::IO
{
AUKN_SYM bool IOSleep(AuUInt32 milliseconds)
{
return WaitFor(milliseconds, true);
}
AUKN_SYM bool IOYieldFor(AuUInt32 milliseconds)
{
return WaitFor(milliseconds, false);
}
}

12
Source/IO/IOSleep.hpp Executable file
View File

@ -0,0 +1,12 @@
/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: IOSleep.hpp
Date: 2022-8-5
Author: Reece
***/
#pragma once
namespace Aurora::IO
{
}