1. Each form has its own running on a different thread. If you need to interact between the form, you need to interact between the thread.
2. When threaded SLEEP, the system exits the execution queue for a while. When the sleep ends, the system will generate a clock interrupt, so that the thread returns to the execution queue to restore the thread.
3. If the parent thread ends in the sub-thread, the sub-thread will be forced to end while the parent thread ends. The thread.join () method waits the parent thread until the sub-thread ends. The consequences of the Abort () method are unrecoverable termination threads.
4. The starting thread can be called a primary thread, and if all the front desk threads are stopped, the main thread can be terminated, and all the background threads will terminate unconditionally. The background thread is only one difference with the front desk thread, that is, the background thread does not hinder the termination of the program. Once all the front desk threads are terminated, the CLR will completely terminate the process by calling the Abort () method of any background process in any survival. 6. Hang up, sleep (can be called-blocking, pause) Unlike Thread.Sleep, thread.suspend does not stop the thread immediately. It can only hang the thread until the thread reaches the safety point. If the thread has not started or has stopped, it will not hang. Calling thread.Resume will make another thread to skip the suspended state and keep the thread continue. A thread cannot call another thread to call Sleep, but a thread can call another thread to call SUSPEND. You can also use many other ways to block the thread. For example, a thread can wait for another thread (sub-thread) to stop by calling thread.join. Use monitor.wait to wait for a thread to access a synchronization object.
5. Keyword LOCK can define a code as a critical section, and the mutual exclusion section only allows only one thread to enter execution, while other threads must wait. Multi-threaded public use When you use a Lock key, here Monitor, Monitor provides a solution that makes a thread share resource. The Monitor class can lock an object, and a thread only gets this lock to operate the object. Such as: Monitor.Enter (obj); // Now oqueue object can only be manipulated by the current thread. Monitor.exit (OBJ);
6. At least one primary thread (ie, the master execution instance) at the beginning of a process, which is the main execution process created when you load your program. The message queue is related to thread, one thread like Win2K has one thread and only one message queue (Queue) corresponds to it. When is the message queue generated? On the Win2K system, you have already created a thread from the beginning. A thread can create multiple forms. The message sent to these windows is uniformly sent to the same message queue. Fortunately, the message structure is msg.hwnd points out which window is related to which window is associated with this guarantee message to assign automation and will not Error! 7. Each form belongs to a thread that creates it, directly access or indirectly requesting a form in a thread, will cause runtime errors (VS2005). Workaround: Use the form from Control.Invoke (DELEGATE) method from Control. This method will perform a principal-to-pending method on the thread that creates the form. Note: Under the VS2003, the method of another thread can be directly modified directly or indirectly in a thread without causing an error of the runtime.