mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-19 16:15:07 +00:00
core: switch to spsc_queue for interthread communication
It's much faster than a normal queue.
This commit is contained in:
@@ -347,8 +347,8 @@ reactor::signal_handler::signal_handler(int signo)
|
||||
}
|
||||
|
||||
inter_thread_work_queue::inter_thread_work_queue()
|
||||
: _pending(queue_length)
|
||||
, _completed(queue_length)
|
||||
: _pending()
|
||||
, _completed()
|
||||
, _start_eventfd(0)
|
||||
, _complete_eventfd(0) {
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <system_error>
|
||||
#include <chrono>
|
||||
#include <atomic>
|
||||
#include <boost/lockfree/queue.hpp>
|
||||
#include <boost/lockfree/spsc_queue.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include "util/eclipse.hh"
|
||||
@@ -305,8 +305,10 @@ class smp;
|
||||
class inter_thread_work_queue {
|
||||
static constexpr size_t queue_length = 128;
|
||||
struct work_item;
|
||||
boost::lockfree::queue<work_item*> _pending;
|
||||
boost::lockfree::queue<work_item*> _completed;
|
||||
using lf_queue = boost::lockfree::spsc_queue<work_item*,
|
||||
boost::lockfree::capacity<queue_length>>;
|
||||
lf_queue _pending;
|
||||
lf_queue _completed;
|
||||
writeable_eventfd _start_eventfd;
|
||||
readable_eventfd _complete_eventfd;
|
||||
semaphore _queue_has_room = { queue_length };
|
||||
|
||||
Reference in New Issue
Block a user