示例#1
0
        public override bool Execute()
        {
            try
            {
                syncEventName = new TaskItem(Guid.NewGuid().ToString());

                handle = new EventWaitHandle(false, EventResetMode.ManualReset, syncEventName.ItemSpec);
                handle.Reset();

                threadLock = GetLock(lockName);

                new Thread(new ThreadStart(AsyncExecute)).Start();

                while (m_AsyncThreadState == ThreadState.NOT_STARTED)
                {
                    Thread.Sleep(500);
                }

                return(true);
            }
            catch (Exception e)
            {
                try
                {
                    Log.LogErrorFromException(e);
                }
                catch { }
                return(false);
            }
        }
        public override bool Execute()
        {
            try
            {
                syncEventName = new TaskItem(Guid.NewGuid().ToString());
                
                handle = new EventWaitHandle(false, EventResetMode.ManualReset, syncEventName.ItemSpec);
                handle.Reset();

                threadLock = GetLock(lockName);

                new Thread(new ThreadStart(AsyncExecute)).Start();

                while (m_AsyncThreadState == ThreadState.NOT_STARTED)
                {
                    Thread.Sleep(500);
                }
                
                return true;
            }
            catch (Exception e)
            {
                try
                {
                    Log.LogErrorFromException(e);
                }
                catch { }
                return false;
            }
        }