How and where do I multithread my code. I currently have a Windows service that collects events from the Windows System log. The service forwards collected events to a remote service. My code is in VB.NET. I am using AddHandler and EventWritten to detect when events are generated.
Asked
Active
Viewed 742 times
-2
-
I think i was clear on my real problem. I have a Windows service written in vb.net. It collects events from the Windows system log using hooks to an AddHandler method that references EventWritten. In essence, it gets notified whenever a new event gets generated by the system. It is currently single-threaded. And my question is how do I multithread such an application? – Kidada May 20 '13 at 16:10
1 Answers
1
You use the TPL and create tasks for whatever you want to be asynchronouos. Afterwards you use Task.WaitAll to let you tasks complete. But you specify almost nothing about your real problem which makes it difficult to give advice. I suspect you need to start the tasks for sending events to the service. Awaiting becomes dificult since the model already sound asynchronous.

faester
- 14,886
- 5
- 45
- 56