Writing a New Thread Method
This chapter requires us to extend the capabilities of the current thread function. In the next section, we will extend the usage of the threads.
Modify your existing ThreadFunc to match the code shown in Example 4-8.
Example 4-8. Updates to the current thread method.
Private Sub ThreadFunc() While Not m_ThreadAction.StopThread If Not m_ThreadAction.Pause Then Try For Each TextFile As String In My.Computer.FileSystem.GetFiles( _ My.Resources.IncomingPath, _ FileIO.SearchOption.SearchTopLevelOnly, "*.txt") If m_ThreadAction.Pause Or m_ThreadAction.StopThread Then Exit For End If Try WriteLogEvent(My.Resources.ThreadMessage + TextFile, _ THREAD_INFO, EventLogEntryType.Information, My.Resources.Source) Catch ex As Exception ...
Get Programming Windows® Services with Microsoft® Visual Basic® 2008 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.