1
0
Fork 0
mirror of https://github.com/KingDuckZ/incredis synced 2025-05-10 09:13:30 +00:00

Optimization - I *think* it's correct.

This commit is contained in:
King_DuckZ 2016-12-05 20:50:52 +00:00
parent 657ecd63e2
commit 093d1dd198

View file

@ -204,10 +204,11 @@ namespace redis {
} }
void AsyncConnection::wakeup_event_thread() { void AsyncConnection::wakeup_event_thread() {
if (ev_async_pending(&m_local_data->watcher_wakeup) == false) {
std::lock_guard<std::mutex> lock(m_local_data->libev_mutex); std::lock_guard<std::mutex> lock(m_local_data->libev_mutex);
if (ev_async_pending(&m_local_data->watcher_wakeup) == false)
ev_async_send(m_libev_loop_thread.get(), &m_local_data->watcher_wakeup); ev_async_send(m_libev_loop_thread.get(), &m_local_data->watcher_wakeup);
} }
}
std::mutex& AsyncConnection::event_mutex() { std::mutex& AsyncConnection::event_mutex() {
return m_local_data->libev_mutex; return m_local_data->libev_mutex;