[RESOLVED] System.Management EventWatcher, best practices?
Hi
I'm playing around with this class a little and it seems that while waiting for an event to happen it well waits, freezing the thread until the event is fired.
is this normal behaviour and if so lets say im monitoring the system, would i put these watchers into there own threads?
or is this class not really meant for this?
Re: System.Management EventWatcher, best practices?
I've never actually used that class myself but, from a quick look at the documentation, it appears that you are probably calling the WaitForNextEvent method, which is synchronous and gets just the next event, when you should be calling the Start method, which gets all events up until you call Stop and returns them via the EventArrived event, which is presumably raised on a thread pool thread.
Re: System.Management EventWatcher, best practices?
aahh , yes i was using waitfornextevent. i didnt try anything else yet :)
thanks, ill have a look at those