Results 1 to 2 of 2

Thread: thread.sleep - static

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Location
    India
    Posts
    151

    thread.sleep - static

    I dont know why the thread.sleep is static.If i want to sleep a particular thred how can i do??

    May be there is something in delegate function
    Variety is the spice of life

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    It seems you didn't start the second thread after you set interval . Here is a quick exmple how to do it :

    VB Code:
    1. Dim thread1 As Threading.Thread
    2.     Dim thread2 As Threading.Thread
    3.  
    4.    
    5.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    6.         thread1 = New Threading.Thread(AddressOf threadPro1)
    7.         thread2 = New Threading.Thread(AddressOf threadPro2)
    8.         thread1.Start()
    9.         thread2.Sleep(50000)
    10.         thread2.Start()
    11.     End Sub
    12.  
    13.     Private Sub threadPro1()
    14.         MessageBox.Show("Thread1 fired")
    15.     End Sub
    16.  
    17.     Private Sub threadPro2()
    18.         MessageBox.Show("Thread2 fired")
    19.     End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width