January 2008
Beginner
352 pages
9h 6m
English
For this example we will be adding some very simple threading code. The code will write an event into the event log database similar to the way we did in Chapter 1. However, we will use the new thread method to perform the work and we will use the current <OnStop> code to clean up the thread and specify that the service is shutting down.
The first thing we must do is create the thread function or method. In the Tutorials.vb code file, create the method shown in Example 2-2.
Example 2-2. Simple thread function.
Private Sub ThreadFunc() Try Catch tab as ThreadAbortException Catch ex as Exception Finally End try End Sub
In this example, I am creating a method called <ThreadFunc>. As I mentioned, threads can only access ...
Read now
Unlock full access