Task.timeout readwrite

The Task.timeout property get/set the Task execution timeout in milliseconds. Once the timeout is reached, the Task will be terminated.

Example

local t = sys.Task(function() print("task: started, will sleep 5000ms") sleep(5000) -- long work print("task: finished (this may not run if timed out)") end) -- set a 1 second timeout (milliseconds) t.timeout = 1000 -- start and wait t() await nt print("task.status:", t.status) -- "terminated" expected print("task.expired:", t.expired) -- true if terminated due to timeout