Пример #1
0
    public void Add(AMD_Hello_sayHello cb, int delay)
    {
        lock (this)
        {
            if (!_done)
            {
                //
                // Add the work item.
                //
                CallbackEntry entry = new CallbackEntry();
                entry.cb    = cb;
                entry.delay = delay;

                if (_callbacks.Count == 0)
                {
                    Monitor.Pulse(this);
                }
                _callbacks.Add(entry);
            }
            else
            {
                //
                // Destroyed, throw exception.
                //
                cb.ice_exception(new RequestCanceledException());
            }
        }
    }
Пример #2
0
    public void Add(AMD_Hello_sayHello cb, int delay)
    {
        #if COMPACT
        _m.Lock();
        try
        #else
        lock(this)
        #endif
        {
            if(!_done)
            {
                //
                // Add the work item.
                //
                CallbackEntry entry = new CallbackEntry();
                entry.cb = cb;
                entry.delay = delay;

                if(_callbacks.Count == 0)
                {
        #if COMPACT
                    _m.Notify();
        #else
                    Monitor.Pulse(this);
        #endif
                }
                _callbacks.Add(entry);
            }
            else
            {
                //
                // Destroyed, throw exception.
                //
                cb.ice_exception(new RequestCanceledException());
            }
        }
        #if COMPACT
        finally
        {
            _m.Unlock();
        }
        #endif
    }
Пример #3
0
    public void Add(AMD_Hello_sayHello cb, int delay)
    {
#if COMPACT
        _m.Lock();
        try
#else
        lock (this)
#endif
        {
            if (!_done)
            {
                //
                // Add the work item.
                //
                CallbackEntry entry = new CallbackEntry();
                entry.cb    = cb;
                entry.delay = delay;

                if (_callbacks.Count == 0)
                {
#if COMPACT
                    _m.Notify();
#else
                    Monitor.Pulse(this);
#endif
                }
                _callbacks.Add(entry);
            }
            else
            {
                //
                // Destroyed, throw exception.
                //
                cb.ice_exception(new RequestCanceledException());
            }
        }
#if COMPACT
        finally
        {
            _m.Unlock();
        }
#endif
    }
Пример #4
0
    public void Add(AMD_Hello_sayHello cb, int delay)
    {
        lock(this)
        {
            if(!_done)
            {
                //
                // Add the work item.
                //
                CallbackEntry entry = new CallbackEntry();
                entry.cb = cb;
                entry.delay = delay;

                if(_callbacks.Count == 0)
                {
                    Monitor.Pulse(this);
                }
                _callbacks.Add(entry);
            }
            else
            {
                //
                // Destroyed, throw exception.
                //
                cb.ice_exception(new RequestCanceledException());
            }
        }
    }