' thread does not get any processor time until the main thread The Visual Basic AddressOf operator creates thisĭim t As New Thread(AddressOf ThreadProc) ' The constructor for the Thread class requires a ThreadStart ' the rest of its time slice each time, and then ends.Ĭonsole.WriteLine("Main thread: Start a second thread.") ' It loops ten times, writing to the console and yielding ' The ThreadProc method is called when the thread starts. ' Simple threading scenario: Start a Shared method running Simple threading scenario: Start a static method running the rest of its time slice each time, and then ends.įor ( int i = 0 i Start() to see the difference.Ĭonsole::WriteLine( "Main thread: ThreadProc.Join has returned. It loops ten times, writing to the console and yielding The ThreadProc method is called when the thread starts. ![]() Simple threading scenario: Start a Shared method running The following example demonstrates simple threading functionality. Implements _Thread Public NotInheritable Class Thread Inherits CriticalFinalizerObject Public NotInheritable Class Thread Public NotInheritable Class Thread ![]() Inherit CriticalFinalizerObject Public NotInheritable Class Thread Public sealed class Thread : type Thread = class public ref class Thread sealed : System::Runtime::ConstrainedExecution::CriticalFinalizerObject public ref class Thread sealed public ref class Thread sealed : System::Runtime::InteropServices::_Thread public ref class Thread sealed : System::Runtime::ConstrainedExecution::CriticalFinalizerObject, System::Runtime::InteropServices::_Thread public sealed class Thread : ![]() Creates and controls a thread, sets its priority, and gets its status.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |