示例#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)
    {
        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());
            }
        }
    }
示例#3
0
文件: HelloI.cs 项目: bholl/zeroc-ice
 public override void sayHello_async(AMD_Hello_sayHello cb, int delay, Ice.Current current)
 {
     if(delay == 0)
        {
        Console.Out.WriteLine("Hello World!");
        cb.ice_response();
        }
        else
        {
        _workQueue.Add(cb, delay);
        }
 }
示例#4
0
 public override void sayHello_async(AMD_Hello_sayHello cb, int delay, Ice.Current current)
 {
     if (delay == 0)
     {
         Console.Out.WriteLine("Hello World!");
         cb.ice_response();
     }
     else
     {
         _workQueue.Add(cb, delay);
     }
 }
示例#5
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
    }
示例#6
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
    }