Task 구현
class LogTest_Task : public ACE_Task<ACE_NULL_SYNCH>
{
	typedef ACE_Task<ACE_NULL_SYNCH>	super;
private:
	ACE_Log_Msg_Callback * m_pLogCallback;

public:
	LogTest_Task( ACE_Log_Msg_Callback * logCallback )	:
		super(),
		m_pLogCallback( logCallback )
	{
	}

	virtual int		svc()
	{
		if( m_pLogCallback )
		{
			ACE_LOG_MSG->set_flags( ACE_Log_Msg::MSG_CALLBACK );
			ACE_LOG_MSG->clr_flags( ACE_Log_Msg::STDERR );
			ACE_LOG_MSG->msg_callback( m_pLogCallback );
		}

		// Log 출력.
		ACE_DEBUG( ( LM_DEBUG,
					ACE_TEXT("DEBUG hello World") ) );
		ACE_ERROR( ( LM_ERROR,
					ACE_TEXT("ERROR hello World") ) );	
		return 0;

	}

};


호출
// Task생성및 Task 실행.
LogTest_Task	logTask( ACE_Log_Msg::instance()->msg_callback() );
logTask.activate();
logTask.wait();

+ Recent posts