Changeset - 8105cf91192a
[Not reviewed]
0 1 0
HanzZ - 14 years ago 2011-10-11 01:11:24
hanzz.k@gmail.com
revert
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/spectrumeventloop.cpp
Show inline comments
 
@@ -55,51 +55,51 @@ SpectrumEventLoop::SpectrumEventLoop() : m_isRunning(false) {
 
	else {
 
		/*struct event_base *base = (struct event_base *)*/
 
		event_init();
 
	}
 
#endif
 
}
 

	
 
SpectrumEventLoop::~SpectrumEventLoop() {
 
	stop();
 
}
 

	
 
void SpectrumEventLoop::run() {
 
	m_isRunning = true;
 
	if (m_loop) {
 
		g_main_loop_run(m_loop);
 
	}
 
#ifdef WITH_LIBEVENT
 
	else {
 
		event_loop(0);
 
	}
 
#endif
 
}
 

	
 
void SpectrumEventLoop::handle(Swift::Event *event) {
 
	handleEvent(*event);
 
	delete event;
 
}
 

	
 
void SpectrumEventLoop::stop() {
 
	std::cout << "stopped loop\n";
 
	if (!m_isRunning)
 
		return;
 
	if (m_loop) {
 
		g_main_loop_quit(m_loop);
 
		g_main_loop_unref(m_loop);
 
		m_loop = NULL;
 
	}
 
#ifdef WITH_LIBEVENT
 
	else {
 
		event_loopexit(NULL);
 
	}
 
#endif
 
}
 

	
 
void SpectrumEventLoop::post(const Event& event) {
 
	// pass copy of event to main thread
 
	Event *ev = new Event(event);
 
	LOG4CXX_INFO(logger, "posting event to main thread " << ev);
 
	g_main_context_invoke(g_main_loop_get_context(m_loop), processEvent, ev);
 
// 	purple_timeout_add(0, processEvent, ev);
 
// 	g_main_context_invoke(g_main_loop_get_context(m_loop), processEvent, ev);
 
	purple_timeout_add(0, processEvent, ev);
 
}
0 comments (0 inline, 0 general)