/// <summary> /// 주어진 매개 변수에 따라 스레드를 시작 /// </summary> /// <param name="opCode">The operation code for creating thread.</param> /// <param name="stackSize">The stack size for the thread.</param> /// <returns>true, if succeeded, otherwise false.</returns> public bool Start(ThreadOpCode opCode = ThreadOpCode.CREATE_START, int stackSize = 0) { lock (m_threadLock) { m_parentThreadHandle = Thread.CurrentThread; if (m_status == ThreadStatus.TERMINATED && m_threadHandle == null) { m_threadHandle = new Thread(ThreadEx.EntryPoint, stackSize); if (m_threadHandle != null) { m_threadHandle.Priority = m_threadPriority; if (opCode == ThreadOpCode.CREATE_START) { m_threadHandle.Start(this); m_status = ThreadStatus.STARTED; } else { m_status = ThreadStatus.SUSPENDED; } return(true); } } // System::OutputDebugString(_T("The thread (%x): Thread already exists!\r\n"),m_threadId); return(false); } }
/// <summary> /// Start the Thread according to parameters given. /// </summary> /// <param name="opCode">The operation code for creating thread.</param> /// <param name="stackSize">The stack size for the thread.</param> /// <returns>true, if succeeded, otherwise false.</returns> public bool Start(ThreadOpCode opCode=ThreadOpCode.CREATE_START, int stackSize=0) { lock(m_threadLock) { m_parentThreadHandle=Thread.CurrentThread; if(m_status==ThreadStatus.TERMINATED&& m_threadHandle==null) { m_threadHandle=new Thread(ThreadEx.entryPoint,stackSize); if (m_threadHandle != null) { m_threadHandle.Priority = m_threadPriority; if (opCode == ThreadOpCode.CREATE_START) { m_threadHandle.Start(this); m_status = ThreadStatus.STARTED; } else m_status = ThreadStatus.SUSPENDED; return true; } } // System::OutputDebugString(_T("The thread (%x): Thread already exists!\r\n"),m_threadId); return false; } }