1
// **********************************************************************
3
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
5
// This copy of Ice is licensed to you under the terms described in the
6
// ICE_LICENSE file included in this distribution.
8
// **********************************************************************
11
using System.Diagnostics;
12
using System.Reflection;
13
using System.Collections.Generic;
14
using System.Threading;
16
public class Dispatcher
18
private static void test(bool b)
22
throw new System.Exception();
28
Debug.Assert(_instance == null);
30
_thread = new Thread(run);
39
System.Action call = null;
42
if(!_terminated && _calls.Count == 0)
49
call = _calls.Dequeue();
53
// Terminate only once all calls are dispatched.
64
catch(System.Exception)
66
// Exceptions should never propagate here.
74
dispatch(System.Action call, Ice.Connection con)
91
_instance._terminated = true;
92
Monitor.Pulse(_instance);
95
_instance._thread.Join();
101
return Thread.CurrentThread == _instance._thread;
104
static Dispatcher _instance;
106
private Queue<System.Action> _calls = new Queue<System.Action>();
108
bool _terminated = false;