aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/salticidae/event.h16
-rw-r--r--include/salticidae/network.h3
2 files changed, 5 insertions, 14 deletions
diff --git a/include/salticidae/event.h b/include/salticidae/event.h
index 0600109..df49c58 100644
--- a/include/salticidae/event.h
+++ b/include/salticidae/event.h
@@ -488,19 +488,7 @@ class MPSCQueueEventDriven: public MPSCQueue<T> {
return true;
}
- template<typename U>
- bool try_enqueue(U &&e) {
- static const uint64_t dummy = 1;
- if (!MPSCQueue<T>::try_enqueue(std::forward<U>(e)))
- return false;
- // memory barrier here, so any load/store in enqueue must be finialized
- if (wait_sig.exchange(false, std::memory_order_acq_rel))
- {
- SALTICIDAE_LOG_DEBUG("mpsc notify");
- write(fd, &dummy, 8);
- }
- return true;
- }
+ template<typename U> bool try_enqueue(U &&e) = delete;
};
template<typename T>
@@ -552,6 +540,8 @@ class MPMCQueueEventDriven: public MPMCQueue<T> {
}
return true;
}
+
+ template<typename U> bool try_enqueue(U &&e) = delete;
};
class ThreadCall {
diff --git a/include/salticidae/network.h b/include/salticidae/network.h
index 2cef81d..1b871f5 100644
--- a/include/salticidae/network.h
+++ b/include/salticidae/network.h
@@ -451,7 +451,8 @@ void MsgNetwork<OpcodeType>::Conn::on_read() {
}
#endif
auto conn = static_pointer_cast<Conn>(self());
- while (!mn->incoming_msgs.try_enqueue(std::make_pair(msg, conn)));
+ while (!mn->incoming_msgs.enqueue(std::make_pair(msg, conn), false))
+ std::this_thread::yield();
}
}
}