Follow us on Twitter
Follow us in Facebook
Office Dev Content
SharePoint Dev Content
Blogs for Office developers > SharePoint dev blog
The illustration depicts the flow of actions associated with synchronous and asynchronous before and after event handlers in SharePoint Foundation 2010. Handlers for synchronous events (all Before events are synchronous) are called in their sequential order in the main thread–-that is, in the thread in which the user action occurred. Their sequence order is determined by the value of the sequence number property (SPEventReceiverDefinition.SequenceNumber) for each event. This applies to both Before and After synchronous events.
On the other hand, event handlers for asynchronous events (After events can be asynchronous or synchronous using the SPEventReceiverDefinition.Synchronization property) behave differently. First, they execute in a different thread from the one in which the triggering action occurred. Furthermore, successive asynchronous event handlers execute in successive threads.
Second, although asynchronous handlers are initiated in sequential order (again, based on the SequenceNumber property), there is no guarantee that they will execute or be completed in that same order. Note, too, that handlers for an asynchronous After event can start at any time after its triggering action occurs.
For more information about events, see the following resources in the SharePoint 2010 SDK: