Page MenuHomeFeedback Tracker

Thread keyword not working in release client or server
Closed, ResolvedPublic

Description

The thread keyword is not working in the way that using Sleep() inside a function stops execution there instead of delaying it for a later frame. It does work in the Workbench though. So there appears to be a difference between the script-vm build of workbench and release executables.

I have run this code in different places, via thread ThreadTest(); and GetGame().GetScriptModule().Call(this, "ThreadTest", true, null);

void ThreadTest()
{
    Print("ThreadTest #1");
    Sleep(100);
    Print("ThreadTest #2");
}

Both lead to the same result. The first print shows, but the second does not - in the workbench both show as they should.

I know this keyword is not used in vanilla AR, so this might appear as an unimportant bug, but it is a core essential for my use case that has no alternatives.
I have several operations that are async that I need to await without starting to get into callback hell. So I wanted to group them in one threaded function that can wait for results by using Sleep and see if the results are ready. Without this, I need to split my function into many many sub-functions that call each other when one finishes, making it borderline impossible to write readable code.

Details

Severity
Block
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General

Event Timeline

Arkensor created this task.Aug 26 2022, 8:59 PM
Geez changed the task status from New to Assigned.Aug 30 2022, 1:23 PM
Arkensor added a subscriber: Geez.Dec 8 2022, 1:12 PM

@Geez this problem is fixed in 0.9.7

Geez closed this task as Resolved.Dec 8 2022, 1:25 PM
Geez claimed this task.