Its a feature of modern operating systems with which we can run multiple programs atsame time example Word,Excel etc. | |
Multi-threading forms subset of Multi-tasking instead of having to switch between programsthis feature switches between different parts of the same program.Example you are writingin word and at the same time word is doing a spell check in background. | |
A thread is the basic unit to which the operating system allocates processor time. | |
While VB6 supports multiple single-threaded apartments, it does not support a freethreadingmodel, which allows multiple threads to run against the same set of data. | |
One or more threads run in an AppDomain. An AppDomain is a runtime representationof a logical process within a physical process.Each AppDomain is started with a singlethread, but can create additional threads from any of its threads. | |
Systems.Threading has all the classes related to implement threading.Any .NET applicationwho wants to implement threading has to import this namespace. | |
Thread Priority can be changed by using Threadname.Priority = ThreadPriority.Highest.Inthe sample provided look out for code where the second thread is ran with a high priority. Following are different levels of Priority provided by .NET :- √ ThreadPriority.Highest √ ThreadPriority.AboveNormal √ ThreadPriority.Normal √ ThreadPriority.BelowNormal √ ThreadPriority.Lowest | |
The AddressOf operator creates a delegate object to the BackgroundProcess method. Adelegate within VB.NET is a type-safe, object-oriented function pointer. After the threadhas been instantiated, you begin the execution of the code by calling the Start() methodof the thread. | |
"Thread.CurrentThread" refers to the current thread running in themethod."CurrentThread" is a public static property. | |
Thread's execution can be paused by calling the Thread.Sleep method. This method takesan integer value that determines how long the thread should sleep.ExampleThread.CurrentThread.Sleep(2000). | |
Threading FAQ's
Posted by
Ramu
Labels:
Threading