Thread Priority Values

Propose new features and changes
User avatar
lmstearn
Posts: 694
Joined: 11 Aug 2016, 02:32
Contact:

Thread Priority Values

31 Mar 2017, 06:57

Rather than one navigating through -2147483648 to 2147483647 for thread priority values, perhaps it would have been be more consistent to offer (quoted from Process):
L (or Low), B (or BelowNormal), N (or Normal), A (or AboveNormal), H (or High), R (or Realtime).
Most likely too late now, as far as backward compatibility is concerned.
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Thread Priority Values

31 Mar 2017, 08:24

What do you mean?
Priority: Changes the priority (as seen in Windows Task Manager) of the first matching process to Param3 and sets ErrorLevel to its Process ID (PID). If the PID-or-Name parameter is blank, the script's own priority will be changed. If there is no matching process or there was a problem changing its priority, ErrorLevel is set to 0.

Param3 should be one of the following letters or words: L (or Low), B (or BelowNormal), N (or Normal), A (or AboveNormal), H (or High), R (or Realtime). Note: Any process not designed to run at Realtime priority might reduce system stability if set to that level.
User avatar
lmstearn
Posts: 694
Joined: 11 Aug 2016, 02:32
Contact:

Re: Thread Priority Values

31 Mar 2017, 09:43

For example,

Code: Select all

Thread, Priority, B
looks a little better than

Code: Select all

Thread, Priority, -1147483648
That's all.
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: Thread Priority Values

31 Mar 2017, 10:46

As far as I understand it, "Thread Priority" makes no sense in the context of normal/below normal/etc

"Thread Priority" is for the author to manage the priority of pseudo-threads within his own app:

https://autohotkey.com/docs/misc/Threads.htm

Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Thread Priority Values

31 Mar 2017, 10:51

Note that the thread priority only affects interuption between threads of your script, it has nothing to do with the system priority as the Process, Priority affects. (As far as I understand)
You can do this, if you find it more convenient/readable.

Code: Select all

; Example
SetThreadPriority("Low")

SetThreadPriority(p){
	; L (or Low), B (or BelowNormal), N (or Normal), A (or AboveNormal), H (or High), R (or Realtime).
	static priority:={L:-2,B:-1,N:0,A:1,H:2,R:3}
	Thread, Priority, priority[SubStr(p,1,1)]
	return
}
Cheers.
User avatar
lmstearn
Posts: 694
Joined: 11 Aug 2016, 02:32
Contact:

Re: Thread Priority Values

01 Apr 2017, 00:18

Ah, okay thanks. SetThreadPriority deals with small discrete values where:
A thread with a base priority level above 11 interferes with the normal operation of the operating system
Wonder where they got -2147483648 to 2147483647 from then?
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: Thread Priority Values

01 Apr 2017, 00:21

lmstearn wrote:Ah, okay thanks. SetThreadPriority deals with small discrete values where:
A thread with a base priority level above 11 interferes with the normal operation of the operating system
Wonder where they got -2147483648 to 2147483647 from then?
Did you even read the link I pasted? I already told you that AHK's Threads are not real OS threads..

User avatar
lmstearn
Posts: 694
Joined: 11 Aug 2016, 02:32
Contact:

Re: Thread Priority Values

01 Apr 2017, 00:52

Like to know a little more about AHK threads and their priority attributes.

Code: Select all

SetThreadPriority("Low")

SetThreadPriority(p){
	; L (or Low), B (or BelowNormal), N (or Normal), A (or AboveNormal), H (or High), R (or Realtime).
	;Gets out calculator to derive mean values:
	static priority:={L:-1,610,612,735,B:-536,870,911,N:0,A:536,870,911,H:1,610,612,735,R:2147483647}
	Thread, Priority, priority[SubStr(p,1,1)]
	return
}
Have fun!
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: Thread Priority Values

01 Apr 2017, 09:42

sigh.

User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Thread Priority Values

01 Apr 2017, 12:45

lmstearn wrote:Like to know a little more about AHK threads and their priority attributes.

Code: Select all

SetThreadPriority("Low")

SetThreadPriority(p){
	; L (or Low), B (or BelowNormal), N (or Normal), A (or AboveNormal), H (or High), R (or Realtime).
	;Gets out calculator to derive mean values:
	static priority:={L:-1,610,612,735,B:-536,870,911,N:0,A:536,870,911,H:1,610,612,735,R:2147483647}
	Thread, Priority, priority[SubStr(p,1,1)]
	return
}
Have fun!
It's not a choice AHK can make since this is Windows internal.
Recommends AHK Studio

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 45 guests