| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | priority |
> Pete's First Rule Of Idle Class: the idle class priority level of 0
> is reserved for Pulse; use 1-31 for your programs. Example
> DosSetPriority( PRTYS_THREAD, PRTYC_IDLETIME, 1, 0 );
jl> Do you mean that values -31...-1 shouldn't be used at all?
Priority levels range from 0 to 31. It is a common error to think that
this is valid:
DosSetPriority( PRTYS_THREAD, PRTYC_IDLETIME, -31, 0 );
(or, if you like, replace -31 with PRTYD_MINIMUM).
The *only* time the negative values are used is when the class parameter is
"PRTYC_NOCHANGE"; for all other values, the priorty argment is
a SETTING, not a DELTA.
I have rarely seen PRTYC_NOCHANGE in a program, but see negative values
all the time.
Check out this little program (I wrote it in 16bits because DosGetPrty() is
less hassle than DosGetInfoBlocks()):
// msc: cl /Ox /W3 /Lp prty.c
#define INCL_NOPM
#define INCL_DOS
#include
#include
static void show(void)
{
USHORT v;
DosGetPrty(0, &v, 0);
printf("Current priority = %04x\n", v);
}
int main(void)
{
int i;
DosSetPrty(PRTYS_THREAD, PRTYC_REGULAR, 31, 0);
printf("START\n");
show();
printf("\nTrying a DELTA in a specified class (invalid):\n");
for(i=0; i<5; i++){
DosSetPrty(PRTYS_THREAD, PRTYC_REGULAR, -1, 0);
show();
}
printf("\nTrying a positive DELTA in current class (valid):\n");
for(i=0; i<5; i++){
DosSetPrty(PRTYS_THREAD, PRTYC_NOCHANGE, 1, 0);
show();
}
printf("\nTrying a negative DELTA in current class (valid):\n");
for(i=0; i<5; i++){
DosSetPrty(PRTYS_THREAD, PRTYC_NOCHANGE, -1, 0);
show();
}
}
The output:
START
Current priority = 021f
Trying a DELTA in a specified class (invalid):
Current priority = 0200
Current priority = 0200
Current priority = 0200
Current priority = 0200
Current priority = 0200
Trying a positive DELTA in current class (valid):
Current priority = 0201
Current priority = 0202
Current priority = 0203
Current priority = 0204
Current priority = 0205
Trying a negative DELTA in current class (valid):
Current priority = 0204
Current priority = 0203
Current priority = 0202
Current priority = 0201
Current priority = 0200
--- Maximus/2 2.02p1
* Origin: Sol 3/Toronto (905)858-8488 (1:259/414)SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430 SEEN-BY: 711/807 808 809 934 942 949 712/353 515 713/888 800/1 7877/2809 @PATH: 259/414 400 99 250/99 3615/50 229/2 12/2442 711/409 808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.