| 网站首页 | VB.Net实例分析 | .Net技术文摘 | 下载中心 | VB.Net书籍笔记 | .Net源码 | VBS脚本与组件调用 | Windows2008技术文摘 | 给我们留言 | 
最新公告:

  没有公告

您现在的位置: 乐博网 >> VB.Net实例分析 >> 服务进程编程 >> 实例分析正文
最新推荐 更多内容
Threading-JoinThread的实例
Threading-JoinThread的实例
作者:sdk    来源:microsoft     更新时间:2008-1-9

所属分类 : Threading

JoinThread的实例

代码如下:

'-----------------------------------------------------------------------
'  This file is part of the Microsoft .NET Framework SDK Code Samples.
'
'  Copyright (C) Microsoft Corporation.  All rights reserved.
'
'This source code is intended only as a supplement to Microsoft
'Development Tools and/or on-line documentation.  See these other
'materials for detailed information regarding Microsoft code samples.
'
'THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
'KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
'IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'PARTICULAR PURPOSE.
' =====================================================================
'
'  File:      JoinThread.vb
'
'  Summary:   Demonstrates how to wait for another thread to exit
'
'=====================================================================*/

Option Explicit On
Option Strict On


Imports System
Imports System.Threading

class App

   Shared Sub MyThreadMethod()
      Console.WriteLine("This is the secondary thread running.")
   End sub

   Shared Sub Main()
      Console.WriteLine("This is the primary thread running.")
      ' MyThreadMethod is the secondary thread's entry point.
      Dim t as New Thread(New ThreadStart(AddressOf MyThreadMethod))

      ' Start the thread
      t.Start()

      ' Wait for the thread to exit
      t.Join()
      Console.WriteLine("The secondary thread has terminated.")
    End Sub
End class

  • 上一篇:

  • 下一篇:
  • 【字体: 】【打印此文】【关闭窗口
      相关文章:(只显示最新16条)
    Threading-WaitSynchronization的实例
    Threading-Timers的实例
    Threading-ReaderWriterSynchronization的实例
    Threading-Pools的实例
    Threading-MonitorSynchronization的实例

    | 设为首页 | 加入收藏 | 联系站长 | | 友情链接 | 版权申明 |
    乐博网欢迎各种媒体转载我们的原创作品[转载请注明出处];我们鼓励更多VB.Net开发者一起加入研究与探讨;如发现文章访问错误、内容错误或版权疑问、内容有违相关法律(如涉及政治、色情、反动或散布虚假有害信息)等情况,请及时向我们举报,我们将及时纠正!
    联系邮箱:Shiny#vip.qq.com (#替换为@) QQ交流群: 40797788 [闽ICP备05014267号]