Using NotificationEvent vs. SynchronizationEvent...

Suppose I am generating an irp to do a query standard info on a fileObject.
In my irp creation routine, i make the irp, set everything up (including
an event). i call IoCallDriver(…). Then i wait for my event to be set
(from my completion routine) using KeWaitForSingleObject(…).

I have seen several different implementations of this. Some use a
NotificationEvent, while others use a SynchronizationEvent.

The docs I’ve read say that a notification event sets the event for all
threads, while a sync event only sets it for the current thread. In the NT
Insider, it was mentioned that a Notification event retains thread
ownership info (great for troubleshooting deadlocks) while a sync event
doesn’t.

So…

When is it proper to use a NotificationEvent vs. a SynchronizationEvent
when waiting for an operation to be signaled complete from a completion
routine?

tia - jb


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Neither a notification or a synchronization event has any concept of
ownership.

As for the difference between them, a notification event signals the event
object and wakes up all its waiters. A synchronization event wakes up one
waiter and resets the event object to the non-signalled state. If no thread
is waiting when a synchronization event is signalled, then the event object
remains in the signalled state until a thread waits on the event object or
KeResetEvent is called. This prevents a lost wakeup.

I suggest you use a notification event in your scenario because it may help
you debug. For example, you will be able to tell whether or not the event
was signalled. This would tell you whether or not your completion routine
was invoked.

-----Original Message-----
From: xxxxx@earthlink.net [mailto:xxxxx@earthlink.net]
Sent: Tuesday, April 17, 2001 4:27 AM
To: File Systems Developers
Subject: [ntfsd] Using NotificationEvent vs. SynchronizationEvent…

Suppose I am generating an irp to do a query standard info on
a fileObject.
In my irp creation routine, i make the irp, set everything
up (including
an event). i call IoCallDriver(…). Then i wait for my
event to be set
(from my completion routine) using KeWaitForSingleObject(…).

I have seen several different implementations of this. Some use a
NotificationEvent, while others use a SynchronizationEvent.

The docs I’ve read say that a notification event sets the
event for all
threads, while a sync event only sets it for the current
thread. In the NT
Insider, it was mentioned that a Notification event retains thread
ownership info (great for troubleshooting deadlocks) while a
sync event
doesn’t.

So…

When is it proper to use a NotificationEvent vs. a
SynchronizationEvent
when waiting for an operation to be signaled complete from a
completion
routine?

tia - jb


You are currently subscribed to ntfsd as: xxxxx@nsisw.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> The docs I’ve read say that a notification event sets the event for all

threads, while a sync event only sets it for the current thread.

Yes. The second difference is that a sync event is auto-unsignaled after
awakening a single thread. This makes the sync event a mutex-like thing - in
fact, ExxxxFastMutex are built around the sync event.
The notification event remains signaled and must be unsignaled manually.

In the NT
Insider, it was mentioned that a Notification event retains thread
ownership info (great for troubleshooting deadlocks) while a sync event
doesn’t.

Maybe in Whistler?
Surely not so on NT4, and I have doubts on w2k.
KEVENT is just DISPATCHER_HEADER - the wait list head, no ownership
semantics.

When is it proper to use a NotificationEvent vs. a SynchronizationEvent
when waiting for an operation to be signaled complete from a completion
routine?

Any will suit, but usually NotificationEvent is a general kind of event -
SynchronizationEvent is used rarely.

Max


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com