Bug with using Sleep in multiple threads [v2-a131]

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
quaritexa
Posts: 32
Joined: 09 Nov 2017, 21:03

Bug with using Sleep in multiple threads [v2-a131]

Post by quaritexa » 17 Apr 2021, 05:13

[Moderator's note: Topic moved from AutoHotkey v2 Development.]

Bug with using Sleep in multiple threads [v2-a131].

Example:

Code: Select all

Persistent
SetTimer () => ( Sleep(5000), ToolTip("A") ), -100
Sleep 200
ToolTip "B"
Expected behavior:
Show ToolTip("B") after about 200ms after running the script and then after about 4900ms show ToolTip("A").

Real life:
Show ToolTip("A") after about 5100ms and then almost instantly Show ToolTip("B").

Most likely, this is reproduced on v1.
just me
Posts: 9439
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Bug with using Sleep in multiple threads [v2-a131]

Post by just me » 17 Apr 2021, 06:00

Code: Select all

SetTimer () => ( Sleep(5000), ToolTip("A") ), -100
Sleep 200 ; <- will be interrupted by the timer thread after 100 ms
Post Reply

Return to “Ask for Help (v2)”