JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Resuming Threads

After you've suspended thread execution using the Thread class's Suspend method (see the previous topic), you can resume execution with the Resume method, like this:

NewThread.Resume()

For example, we used the Resume method in the Threading example discussed in the In Depth section of this chapter to resume thread execution after the user clicked the "Suspend Counting" button. Here's how that example uses the Resume method when the user clicks the "Resume Counting" button (you can see it at work in Figure 24.10):

    Dim Thread1 As New System.Threading.Thread(AddressOf counter1.Count)
        
    Private Sub Button6_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button6.Click
        Thread1.Resume()
    End Sub

For more on how this example works, take a look at the discussion in the In Depth section of this chapter.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor