[dba-VB] Unhooking events while they are running

jwcolby jwcolby at colbyconsulting.com
Tue Nov 1 14:44:53 CDT 2011


I am using the directory watcher class.  When the parent class to start, it hooks the events and 
when it is told to stop it unhooks the events.

My question is simply that events are asynchronous and as such could occur at the same instant that 
the parent class is being told to stop.  I use a boolean evFileDeletedIsRunning flag which the event 
sets as the first line inside of that event and clears as the last line of the event.  I then check 
this flag before unhooking the event.

Is this adequate protection?  What happens if an event is unhooked while the event sink is running? 
  Is it a page fault or something less catastrophic?

-- 
John W. Colby
Colby Consulting

Reality is what refuses to go away
when you do not believe in it



More information about the dba-VB mailing list