diff options
author | Mark Spruiell <mes@zeroc.com> | 2011-05-09 16:24:52 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2011-05-09 16:24:52 -0700 |
commit | 5d7de7f8f909d7a4910531a077e514955a1b0fdc (patch) | |
tree | 77b437188795dab60de6fbc5212528b0d88c182f /cs/src/Ice/AsyncIOThread.cs | |
parent | Ice 3.4.2 installer updates (diff) | |
download | ice-5d7de7f8f909d7a4910531a077e514955a1b0fdc.tar.bz2 ice-5d7de7f8f909d7a4910531a077e514955a1b0fdc.tar.xz ice-5d7de7f8f909d7a4910531a077e514955a1b0fdc.zip |
merging .NET Compact Framework support
Diffstat (limited to 'cs/src/Ice/AsyncIOThread.cs')
-rw-r--r-- | cs/src/Ice/AsyncIOThread.cs | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/cs/src/Ice/AsyncIOThread.cs b/cs/src/Ice/AsyncIOThread.cs index 9b00acc8298..fbd06625de9 100644 --- a/cs/src/Ice/AsyncIOThread.cs +++ b/cs/src/Ice/AsyncIOThread.cs @@ -37,21 +37,31 @@ namespace IceInternal public void queue(ThreadPoolWorkItem callback) { - lock(this) + _m.Lock(); + try { Debug.Assert(!_destroyed); _queue.AddLast(callback); - Monitor.Pulse(this); + _m.Notify(); + } + finally + { + _m.Unlock(); } } public void destroy() { - lock(this) + _m.Lock(); + try { Debug.Assert(!_destroyed); _destroyed = true; - Monitor.Pulse(this); + _m.Notify(); + } + finally + { + _m.Unlock(); } } @@ -68,7 +78,8 @@ namespace IceInternal LinkedList<ThreadPoolWorkItem> queue = new LinkedList<ThreadPoolWorkItem>(); while(true) { - lock(this) + _m.Lock(); + try { if(_destroyed && _queue.Count == 0) { @@ -77,13 +88,17 @@ namespace IceInternal while(!_destroyed && _queue.Count == 0) { - Monitor.Wait(this); + _m.Wait(); } LinkedList<ThreadPoolWorkItem> tmp = queue; queue = _queue; _queue = tmp; } + finally + { + _m.Unlock(); + } foreach(ThreadPoolWorkItem cb in queue) { @@ -148,5 +163,6 @@ namespace IceInternal } private HelperThread _thread; + private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor(); } } |