Skip to content

Sys.IsRunning

boxgaming edited this page Jul 11, 2026 · 3 revisions

Returns true (-1) or false (0) depending on whether the main program execution is still active.
Available in release 0.11.0

This method can be useful when implementing event-based programming which can still respond to user or timed events after the main program has completed execution.

Syntax

result% = Sys.IsRunning

Example

Import Sys From "lib/lang/system.bas"

Sys.SetTimeout @CheckTime, 1000

Print "Press ESC to exit..."
While _KeyHit <> 27
    _Limit 60
WEnd
Print "End of main code"

Sub CheckTime
    Print Sys.IsRunning; ": "; Sys.TimeInMillis
    
    If Sys.IsRunning Then 
        Sys.SetTimeout @CheckTime, 1000
    End If
End Sub

Output

Print ESC to exit...
 -1: 1783779913478
 -1: 1783779914480
 -1: 1783779915481
 -1: 1783779916484
 -1: 1783779917486
End of main code
 0: 1783779918487

See Also

Sys.SetTimeout

Clone this wiki locally