zoukankan      html  css  js  c++  java
  • Vb线程控制

    Dim thread As LedShow = New LedShow
    thread.iTransMode = 1
    thread.iConType = 3
    thread.iping = 1
    thread.Led_Ip = led_ip.ToString() '//LED网卡IP地址
    Dim th1 As Threading.Thread
    If type = "1" Then '//预约一笔警示信息
    thread.mesinfo = region + " " + groupname + " " + sender_name + " [APPT++1]!!"
    thread.ext = ext
    th1 = New Threading.Thread(New ThreadStart(AddressOf thread.SetLEDAPPT))
    th1.Start() '//开启线程
    Dim tcb As New TimerCallback(AddressOf th1.Abort) '建立一个终止线程的委托
    Dim objTimer As Timer '初始化定时器
    '建立一个定时器每10秒调用一个过程,并且只执行调用一次。tcb,终止线程的委托。100000ms,首次10s后调用。0,只调用一次(正数,多长时间调用一次)。
    objTimer = New Timer(tcb, Nothing, TimeSpan.FromSeconds(10000), TimeSpan.FromSeconds(0))
    objTimer.Change(TimeSpan.FromSeconds(10000), TimeSpan.FromSeconds(0))
    objTimer.Dispose() '释放定时器资源
    'th1.Abort() '终止线程
    'Threading.Thread.Sleep(10000) '线程等待10秒
    'th1.Join() '//等待线程结束运行下方的程式
    End If

  • 相关阅读:
    saltstack笔记
    saltstack学习篇
    tomcat学习篇
    memcache笔记
    sed、awk学习篇
    javascript function call
    jvm性能调优工具
    spring boot 单元测试
    activemq 分布式事务
    sringboot 集成dobbo2.5.3
  • 原文地址:https://www.cnblogs.com/lx1988729/p/3124352.html
Copyright © 2011-2022 走看看