Slight thread problem

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
pneumatic
Posts: 338
Joined: 05 Dec 2016, 01:51

Slight thread problem

05 Oct 2018, 02:49

Hello

In my script I am doing some important stuff in a Critical thread. At the same time I'd like my UpdateProgressBar timer (which animates my progress bar by gradually incrementing it up to the current position which I specify inside the Critical thread as it gets its work done) to still be able to interrupt the Critical thread so that it can animate the progress bar.

My initial thought is to swap Critical for Thread, Priority, 1, and set the UpdateProgressBar timer to Thread, Priority, 2 so it is the only thing which can interrupt the important thread.

The new problem is that Thread, Priority doesn't buffer threads that try to interrupt it, so any other timer that happens to fire will be discarded, and that might cause some problems. For example I have a thread that fires once per day and if that just so happens to fire during that thread, then user will have to wait another 24 hours before they get the next update.

It's an edge case and probably will almost never occur, but it's the kind of thing that keeps me up at night :lol: I want my script to be air tight!

Any way around this?

Thanks.
pneumatic
Posts: 338
Joined: 05 Dec 2016, 01:51

Re: Slight thread problem

06 Oct 2018, 21:43

Just bumping a once and final time just in case.

After going over the documentation again I believe Critical is the only thread mode which can buffer events, therefore it is not possible to animate my progress bar smoothly during the Critical thread. What I can do though is just manually set a whole bunch of progress bar updates at various points in the Critical thread. The downside is that the progress bar will suddenly jump to its new position rather than animating smoothly. On the other hand it seems I only have that one thread which could potentially be discarded, and its not a disaster if it misses its daily update, so maybe I will use the Thread, Priority workaround.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 262 guests