home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2005 June (DVD) / DPPRO0605DVD.iso / dotNETSDK / SETUP.EXE / netfxsd1.cab / FL_JoinThread_vb________.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Encoding:
Text File  |  2001-08-21  |  1.5 KB  |  47 lines

  1. ' =====================================================================
  2. '
  3. '  File:      JoinThread.vb
  4. '
  5. '  Summary:   Demonstrates how to wait for another thread to exit
  6. '
  7. '---------------------------------------------------------------------
  8. '  This file is part of the Microsoft .NET SDK Code Samples.'
  9. '
  10. '  Copyright (C) Microsoft Corporation.  All rights reserved.'
  11. '
  12. 'This source code is intended only as a supplement to Microsoft
  13. 'Development Tools and/or on-line documentation.  See these other
  14. 'materials for detailed information regarding Microsoft code samples.
  15. '
  16. 'THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  17. 'KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  18. 'IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  19. 'PARTICULAR PURPOSE.
  20. '=====================================================================*/
  21.  
  22. Option Explicit On 
  23. Option Strict On
  24.  
  25.  
  26. Imports System
  27. Imports System.Threading
  28.  
  29. class App 
  30.  
  31.    Shared Sub MyThreadMethod() 
  32.       Console.WriteLine("This is the secondary thread running.")
  33.    End sub
  34.  
  35.    Shared Sub Main() 
  36.       Console.WriteLine("This is the primary thread running.")
  37.       ' MyThreadMethod is the secondary thread's entry point.
  38.       Dim t as New Thread(New ThreadStart(AddressOf MyThreadMethod))
  39.  
  40.       ' Start the thread
  41.       t.Start()
  42.  
  43.       ' Wait for the thread to exit
  44.       t.Join()
  45.       Console.WriteLine("The secondary thread has terminated.")
  46.     End Sub
  47. End class