|
|
1.1.1.2 ! root 1: Sample: Using Thread API Functions ! 2: 1.1 root 3: Summary: 4: 5: The THREADS sample application shows how to use 6: SetThreadPriority, SuspendThread, and ResumeThread. 7: 8: More Information: 9: 10: To use THREAD, start the application. Two threads will be 11: created; one will draw a red rectangle and the other a green 12: rectangle. Both of these rectangles move about the window; 13: their speed and behavior is based on the thread priority and 14: its resumed/suspended status. The priority and status are 15: set through menu selections. 16: 17: Of special interest is the suspension count. The system 18: keeps track of the number of times a thread has been 19: suspended and resumed. Each time the thread is suspended, 20: the count is incremented; each time it is resumed, the count 21: is decremented. The suspension count can either be tracked 22: by applications manually, the same way this sample 23: application does, or the return value from ResumeThread and 24: SuspendThread can be used to obtain the previous suspension 25: count before the call was made. Only when the suspension 26: count is zero will the thread run. 27: 1.1.1.2 ! root 28: A thread now has seven priorities exposed at the API level: 1.1 root 29: 1.1.1.2 ! root 30: THREAD_PRIORITY_IDLE 1.1 root 31: THREAD_PRIORITY_LOWEST 32: THREAD_PRIORITY_BELOW_NORMAL 33: THREAD_PRIORITY_NORMAL 34: THREAD_PRIORITY_ABOVE_NORMAL 35: THREAD_PRIORITY_HIGHEST 1.1.1.2 ! root 36: THREAD_PRIORITY_TIME_CRITICAL 1.1 root 37: 1.1.1.2 ! root 38: Note that THREAD_PRIORITY_TIME_CRITICAL should be used very ! 39: cautiously by an application, and only if needed. Setting a ! 40: thread to this level will interfere with the application's ! 41: window performance, and the performance of other applications ! 42: being run on the system.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.