예제 #1
0
파일: log.cpp 프로젝트: ruleless/cill
void Log::printLog(ELogLevel level, const char *msg)
{
    if (NULL == msg)
        return;

    if ((mLevel & (int)level) == 0)
        return;

#if PLATFORM == PLATFORM_WIN32
# ifdef _DEBUG
    if (::IsDebuggerPresent())
    {
        ::OutputDebugString(msg);
    }
# endif
#endif

    THREAD_MUTEX_LOCK(mMutex);

    mInlist->push_back(_MSG());
    _MSG &msgnode = mInlist->back();
    msgnode.level = level;
    msgnode.time = mHasTime ? time(0) : 0;
    msgnode.msg = msg;

    THREAD_MUTEX_UNLOCK(mMutex);

    THREAD_SINGNAL_SET(mCond);
}
예제 #2
0
파일: log.cpp 프로젝트: ruleless/cill
void Log::finalise()
{
    if (!mInited)
        return;

    mbExit = true;
    THREAD_SINGNAL_SET(mCond);
#if PLATFORM == PLATFORM_WIN32
    ::WaitForSingleObject(mTid, INFINITE);
    ::CloseHandle(mTid);
#else
    pthread_join(mTid, NULL);
#endif

    mOutlist = mInlist;
    _flushOutlist();

    THREAD_SINGNAL_DELETE(mCond);
    THREAD_MUTEX_DELETE(mMutex);

    mLogPrinter.clear();

    mInited = false;
}
예제 #3
0
	/**
		发送条件信号
	*/
	int sendCondSignal(void)
	{
		return THREAD_SINGNAL_SET(cond_);
	}