예제 #1
0
파일: DBThread.cs 프로젝트: angel2230/ZZZ
        public bool Create(string strDSN, DBThreadTaskQ refTaskQ, DBThreadTaskResultQ refTaskResultQ)
        {
            m_refTaskQ       = refTaskQ;
            m_refTaskResultQ = refTaskResultQ;

            if (m_DB.Connect(strDSN) == false)
            {
                FileLog.Instance.Write("Failed! DBThread,Create(), DB 연결 실패, Msg = {0}", m_DB.LastErrorMsg);
                return(false);
            }

            try
            {
                m_bRunWorker         = true;
                m_bIsDestroyedWorker = false;

                m_threadWorker = new Thread(new ThreadStart(_WorkerThread));
                m_threadWorker.Start();
            }
            catch (System.Exception e)
            {
                m_bRunWorker         = false;
                m_bIsDestroyedWorker = true;

                FileLog.Instance.Write("Failed! DBThread,Create(), Msg = {0}", e.Message);
                return(false);
            }
            return(true);
        }
예제 #2
0
        public bool Create(uint nThreadCount, string strDSN, DBThreadTaskQ refTaskQ, DBThreadTaskResultQ refTaskResultQ)
        {
            for (int i = 0; i < nThreadCount; ++i)
            {
                DBThread dbThread = new DBThread();

                if (dbThread.Create(strDSN, refTaskQ, refTaskResultQ) == false)
                {
                    return(false);
                }

                m_listThread.Add(dbThread);
            }
            return(true);
        }