1 // ****************************************************************************
2 // Copyright (C) 2000-2001 Microsoft Corporation. All rights reserved.
5 // Workflow Base exception class
8 // Base class for WINOE Runtime engine exception
11 // Date Ver By Remarks
12 // ~~~~~~~~~~ ~~~ ~~~~~~~~ ~~~~~~~~~~~~~~
13 // 03/08/01 1.0 Microsoft Created.
14 // ****************************************************************************
16 using System
.Runtime
.Serialization
;
17 using System
.Security
.Permissions
;
18 using System
.Collections
.Generic
;
19 using System
.Globalization
;
20 using System
.Threading
;
21 using System
.Workflow
;
22 using System
.Workflow
.Runtime
;
23 using System
.Workflow
.ComponentModel
;
25 namespace System
.Workflow
.Runtime
28 * The Unload() method has been changed so that
29 * any Unload requests made while in the middle of an atomic
30 * transaction wait for the atomic transaction to complete.
31 * This makes use of an ManualResetEvent. Unload() waits on the event:
33 * But waiting with the executor and scheduler locks held
34 * will block everything else.
36 * The solution is to have a custom internal exception class that has the
37 * ManualResetEvent as an internal property. If Unload() finds itself in the middle
38 * of an atomic transaction, it throws the Exception. The Exception is propogated upwards
39 * until we reach the method that was the first to grab the executor lock.
41 * We then drop that lock and wait on the event handle. As soon as the handle is
42 * Set() by DisposeTransaction(), we grab the executor lock and do everything all over.
45 internal class ExecutorLocksHeldException
: Exception
47 private ManualResetEvent handle
;
49 public ExecutorLocksHeldException(ManualResetEvent handle
)
54 internal ManualResetEvent Handle