예제 #1
0
            private void Process(object o)
            {
                while (true)
                {
                    CommandArgs args;

                    using (new TryLock(_syncObject, Timeout))
                    {
                        if (_commands.Count == 0)
                        {
                            _inProcess = false;
                            _disposeEvent.Set();
                            return;
                        }

                        args = _commands.Dequeue();
                    }

                    try
                    {
                        using (args)
                        {
                            var command = _queue._api.GetCommand(args.Unpacked.Package.Id);
                            command.Run(args);
                        }
                    }
                    catch (Exception e)
                    {
                        _queue.OnError(e);
                    }
                }
            }
예제 #2
0
            private void Process(object o)
            {
                while (true)
                {
                    CommandContainer commandContainer;

                    using (new TryLock(syncObject, Timeout))
                    {
                        if (commands.Count == 0)
                        {
                            inProcess = false;
                            disposeEvent.Set();
                            return;
                        }

                        commandContainer = commands.Dequeue();
                    }

                    try
                    {
                        commandContainer.Run();
                    }
                    catch (Exception e)
                    {
                        queue.OnError(e);
                    }
                }
            }