Ejemplo n.º 1
0
        public static IAimActivityMonitor Create(SynchronizationContext synchronizationContext)
        {
            lock (_instanceLock)
            {
                if (_instance == null)
                {
                    _instance = new AimActivityMonitorReal();
                }

                _proxyCount++;
                Platform.Log(LogLevel.Debug, "AimActivityMonitor proxy created (count = {0})", _proxyCount);
                return(new AimActivityMonitorProxy(_instance, synchronizationContext));
            }
        }
Ejemplo n.º 2
0
        internal static void OnProxyDisposed()
        {
            lock (_instanceLock)
            {
                if (_proxyCount == 0)
                {
                    return;                     //Should never happen, except possibly when there's unit tests running.
                }
                --_proxyCount;
                Platform.Log(LogLevel.Debug, "AimActivityMonitor proxy disposed (count = {0}).", _proxyCount);
                if (_proxyCount > 0)
                {
                    return;
                }

                var monitor = _instance;
                _instance = null;
                //No need to do this synchronously.
                ThreadPool.QueueUserWorkItem(ignore => monitor.Dispose());
            }
        }
        internal static void OnProxyDisposed()
        {
            lock (_instanceLock)
            {
                if (_proxyCount == 0)
                    return; //Should never happen, except possibly when there's unit tests running.

                --_proxyCount;
                Platform.Log(LogLevel.Debug, "AimActivityMonitor proxy disposed (count = {0}).", _proxyCount);
                if (_proxyCount > 0)
                    return;

                var monitor = _instance;
                _instance = null;
                //No need to do this synchronously.
                ThreadPool.QueueUserWorkItem(ignore => monitor.Dispose());
            }
        }
        public static IAimActivityMonitor Create(SynchronizationContext synchronizationContext)
        {
            lock (_instanceLock)
            {
                if (_instance == null)
                    _instance = new AimActivityMonitorReal();

                _proxyCount++;
                Platform.Log(LogLevel.Debug, "AimActivityMonitor proxy created (count = {0})", _proxyCount);
                return new AimActivityMonitorProxy(_instance, synchronizationContext);
            }
        }