前面已经说过,Wi n d o w s的一个主要目标是为程序的运行提供一个强壮的环境。为实现这个目标,要保证每个线程运行在一个环境中,在这个环境中每个线程都相信自己是唯一运行的线程。更确切地说,每个线程必须有完全不受其他线程影响的消息队列。而且,每个线程必须有一个模拟环境,使线程可以维持它自己的键盘焦点(keyboard focus)、窗口激活、鼠标捕获等概念。
As I have already said, one of the main goals of Windows is to offer a robust environment for all the applications running. To meet this goal, each thread must run in an environment in which it believes that it is the only thread running. More specifically, each thread must have message queues that are totally unaffected by other threads. In addition, each thread must have a simulated environment that allows the thread to maintain its own notion of keyboard focus, window activation, mouse capture, and so on.
As we described above,one main goal of Windows is to provide the running programs a robust environment. To achieve this goal, it is guaranteed that each thread is running in a context in which each thread believes that itself is the only running thread. More specifically, each thread must have a message queue which is not disturbed by other threads. Moreover, each thread must have a simulant context which makes the thread have its own concepts such as keyboard focus,window activation,mouse capture etc.