if ((m_eventCallHandler = ecore_event_handler_add(m_eventId, &StaticDispatchEvent, this)) == NULL)
ThrowMsg(Exception::CreateFailed, "Failed to register event handler!");
+ // Allocate WaitableEvent
+ m_crossEventCallInvoker = new WaitableEvent();
+
// Register cross event handler
- m_crossEventCallHandler = ecore_main_fd_handler_add(m_crossEventCallInvoker.GetHandle(), ECORE_FD_READ, &StaticDispatchCrossInvoker, this, NULL, NULL);
+ m_crossEventCallHandler = ecore_main_fd_handler_add(m_crossEventCallInvoker->GetHandle(), ECORE_FD_READ, &StaticDispatchCrossInvoker, this, NULL, NULL);
if (m_crossEventCallHandler == NULL)
ThrowMsg(Exception::CreateFailed, "Failed to register cross event handler!");
MainEventDispatcher::~MainEventDispatcher()
{
- // Remove event class handler
- ecore_event_handler_del(m_eventCallHandler);
- m_eventCallHandler = NULL;
-
// Remove cross event handler
ecore_main_fd_handler_del(m_crossEventCallHandler);
m_crossEventCallHandler = NULL;
-
LogPedantic("ECORE cross-event handler unregistered");
+ // Remove m_crossEventCallInvoker
+ delete m_crossEventCallInvoker;
+ m_crossEventCallInvoker = NULL;
+
+ // Remove event class handler
+ ecore_event_handler_del(m_eventCallHandler);
+ m_eventCallHandler = NULL;
+
// Decrement ECORE init count
// We do not need ecore routines any more
ecore_shutdown();
g_lateMainEventDispatcher = NULL;
}
+void MainEventDispatcher::ResetCrossEventCallHandler()
+{
+ // Remove cross event handler
+ ecore_main_fd_handler_del(m_crossEventCallHandler);
+ m_crossEventCallHandler = NULL;
+ LogPedantic("ECORE cross-event handler unregistered");
+
+ // Re-allocate WaitableEvent
+ delete m_crossEventCallInvoker;
+ m_crossEventCallInvoker = new WaitableEvent();
+
+ // Register cross event handler
+ m_crossEventCallHandler =
+ ecore_main_fd_handler_add(m_crossEventCallInvoker->GetHandle(),
+ ECORE_FD_READ,
+ &StaticDispatchCrossInvoker,
+ this,
+ NULL,
+ NULL);
+
+ if (m_crossEventCallHandler == NULL) {
+ ThrowMsg(Exception::CreateFailed, "Failed to register cross event handler!");
+ }
+
+ LogPedantic("ECORE cross-event handler re-registered");
+}
+
void MainEventDispatcher::StaticDeleteEvent(void *data, void *event)
{
LogPedantic("Static ECORE delete event handler");
// Critical section
{
- m_crossEventCallInvoker.Reset();
+ m_crossEventCallInvoker->Reset();
Mutex::ScopedLock lock(&m_crossEventCallMutex);
m_wrappedCrossEventCallList.swap(stolenCrossEvents);
}
{
Mutex::ScopedLock lock(&m_crossEventCallMutex);
m_wrappedCrossEventCallList.push_back(WrappedEventCall(abstractEventCall, false, 0.0));
- m_crossEventCallInvoker.Signal();
+ m_crossEventCallInvoker->Signal();
}
LogPedantic("Event pushed to cross-thread event list");
{
Mutex::ScopedLock lock(&m_crossEventCallMutex);
m_wrappedCrossEventCallList.push_back(WrappedEventCall(abstractEventCall, true, dueTime));
- m_crossEventCallInvoker.Signal();
+ m_crossEventCallInvoker->Signal();
}
LogPedantic("Event pushed to cross-thread event list");