- Timestamp:
- Apr 25, 2005, 7:18:54 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/sys/priority.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1912 r1913 96 96 /* PRTYC_REGULAR */ 97 97 { 0, 0, -1, -1, -1, -2, -2, -3, -3, -3, -4, -4, -4, -4, -4, -5, -5, -5, -5, -5, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, -8, -9 }, 98 /* PRTYC_TIMECRITICAL */ 99 { -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -20 }, 98 100 /* PRTYC_FOREGROUNDSERVER */ 99 { -10, -11, -11, -11, -11, -12, -12, -12, -12, -12, -13, -13, -13, -13, -13, -14, -14, -14, -14, -14, -15, -15, -15, -15, -15, -16, -16, -16, -16, -16, -16, -17 }, 100 /* PRTYC_TIMECRITICAL */ 101 { -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -20 } 101 { -10, -11, -11, -11, -11, -12, -12, -12, -12, -12, -13, -13, -13, -13, -13, -14, -14, -14, -14, -14, -15, -15, -15, -15, -15, -16, -16, -16, -16, -16, -16, -17 } 102 102 }; 103 103 … … 120 120 121 121 122 /** Convert from Unix to OS/2. Indexed by level + 2 1. */122 /** Convert from Unix to OS/2. Indexed by level + 20. */ 123 123 static const unsigned short gToOS2[41] = 124 124 { … … 128 128 0x041f, 0x0419, 0x0414, 0x040f, 0x040a, 0x0405, 0x0401, 0x0400, 129 129 /* RG (-9 to 0) */ 130 0x021f, 0x021e, 0x0219, 0x0214, 0x020f, 0x02 1a, 0x0207, 0x0205, 0x0202, 0x0200,130 0x021f, 0x021e, 0x0219, 0x0214, 0x020f, 0x020a, 0x0207, 0x0205, 0x0202, 0x0200, 131 131 /* ID (1 to 20) */ /* vv10vv */ 132 132 0x011f, 0x011e, 0x011d, 0x011c, 0x011b, 0x011a, 0x0119, 0x0118, 0x0117, 0x0116, 0x0114, 0x0111, 0x010f, 0x010c, 0x010a, 0x0107, 0x0105, 0x0102, 0x0101, 0x0100 … … 141 141 int __libc_back_priorityOS2FromUnix(int iNice) 142 142 { 143 LIBC_ASSERTM(iNice + 2 1 >= 0 && iNice + 21<= sizeof(gToOS2) / sizeof(gToOS2[0]), "iNice=%d\n", iNice);144 return gToOS2[iNice + 2 1];143 LIBC_ASSERTM(iNice + 20 >= 0 && iNice + 20 <= sizeof(gToOS2) / sizeof(gToOS2[0]), "iNice=%d\n", iNice); 144 return gToOS2[iNice + 20]; 145 145 } 146 146 147 148 #if 0 149 /* testing the tables */ 150 #include <stdio.h> 151 static int iPrev = 20; 152 static int checkOS2(int iPrio) 153 { 154 int iNice = __libc_back_priorityUnixFromOS2(iPrio); 155 int iRev = __libc_back_priorityOS2FromUnix(iNice); 156 if ( iRev > iPrio 157 || (iRev & ~0xff) < (iPrio & ~0xff) 158 || iPrev < iNice) 159 { 160 printf("Error: iPrio=%#x iNice=%d iPrev=%d iRev=%#x\n", iPrio, iNice, iPrev, iRev); 161 return 1; 162 } 163 else 164 printf("Info: iPrio=%#x iNice=%d\n", iPrio, iNice); 165 iPrev = iNice; 166 return 0; 167 } 168 169 int main() 170 { 171 int i; 172 int rc = 0; 173 for (i = 0; i < 32; i++) 174 rc += checkOS2(0x100 | i); 175 for (i = 0; i < 32; i++) 176 rc += checkOS2(0x200 | i); 177 for (i = 0; i < 32; i++) 178 rc += checkOS2(0x400 | i); 179 for (i = 0; i < 32; i++) 180 rc += checkOS2(0x300 | i); 181 for (i = -20; i <= 20; i++) 182 { 183 int iPrio = __libc_back_priorityOS2FromUnix(i); 184 int iRev = __libc_back_priorityUnixFromOS2(iPrio); 185 if (iRev != i) 186 { 187 printf("Error: i=%d iPrio=%#x iRev=%d\n", i, iPrio, iRev); 188 rc++; 189 } 190 } 191 return rc; 192 } 193 194 #endif -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.