Quantcast
Viewing latest article 34
Browse Latest Browse All 729

LibAsync (3.0.2)

Change Log:
--------------------
version 3.0.2:
- Reworked scheduling as a compromise between frame-rate stabilization and throughput. Thanks to @Sharlikran and @Dack.

version 3.0.1:
- Reverted use of zo_callLater.
- Changed values adjustments.

version 3.0.0:
- Trade-off between high frame rate and lower end systems get things done at all.
- Big Thank You to @Dack and @Sharlikran for their improvements and performance testing.

version 2.3.4:
- Update for "Necrom".
- No LibStub support.

version 2.3.2:
- Fixed issue with nested "WaitUntil".

version 2.3.1:
- Forgot to remove return in "ThenDelay".

version 2.3.0:
- Fixed execution order issue, if operation are added ourside a running task.
- Add new operation "ThenDelay".

version 2.2.1:
- Update to API 100033 "Markarth".

version 2.2.0:
- Update to API 100032 "Stonethorn".
- New async functions: While and WaitUntil.

version 2.1.0: Register scheduler as late as possible to take count to all actions not using LibAsync.

version 2.0.2:
- Update to API 100029 "Dragonhold".

version 2.0.1:
- Update to API 100028 "Scalebreaker".

version 2.0.0:
- API bump 100027 "Elsweyr".
- Need to go to 2.0 because of the version check of LibStub.

version 1.10.0:
- API bump 100027 "Elsweyr".
- Use of LibStub is optional.

version 1.9.0:
- Update to API 100026 "Wrathstone".
- For V-Sync off/G-Sync the minimum target framerate is 80.

version 1.8.1:
- Work without LibStub as well.

version 1.8.0:
- API update "Murkmire".
- Adjustment to scheduler calculation: Reduce allowed-time after a burst even if loops still running.
- Change from GetGameTimeMilliseconds to GetGameTimeSeconds, which has in fact more precision. Thanks to @zsban.

Description:
--------------------
Description
For developers:
Read this article of the Wiki.

For users:
There is a new (v3.0.2+) slash command:
/async stall
/async stall 15 is equal to /async stall default

This is the lower limit for the frame-rate and LibAsync stops processing*.
* If your machine is overloaded by other things, the frame-rate still could be even lower. Just saying.

Normally the frame-rate gets stabilized at 60, 30, 20, 15 fps, depending on your system.

API
local async = LibAsync
local task = async:Create(name)

The signature of FuncOfTask is:
local function(task)
end

-- Get the current context, if you are within a FuncOfTask or nil.
function async:GetCurrent()

-- Create an interruptible task context.
function async:Create(name)

-- Resume the execution context.
task:Resume()
-- Suspend the execution context and allow to resume anytime later.
function task:Suspend()

-- Interupt and fully stop the execution context. Can be called from outside to stop everything.
function task:Cancel()

-- Run the given FuncOfTask in your task context execution.
function task:Call(funcOfTask)

-- Continue your task context execution with the given FuncOfTask after the previous as finished.
function task:Then(funcOfTask)

-- Start an interruptible for-loop.
function task:For(from, to, step)
function task:For(pairs(tbl))
function task:For(ipairs(tbl))

-- Execute the async-for with the given step-function. The parameters of the step-function are those you would use in your for body.
function task:Do(func)
The signature if func is function(index) or function(key, value)
If you return async.BREAK within...

Viewing latest article 34
Browse Latest Browse All 729

Trending Articles