MCPcopy Create free account
hub / github.com/bloomberg/quantum / IoQueue

Class IoQueue

quantum/quantum_io_queue.h:40–110  ·  view source on GitHub ↗

============================================================================================== class IoQueue ============================================================================================== @class IoQueue @brief Thread queue for executing IO tasks. @note For internal use only.

Source from the content-addressed store, hash-verified

38/// @brief Thread queue for executing IO tasks.
39/// @note For internal use only.
40class IoQueue : public IQueue
41{
42public:
43 using TaskList = std::list<IoTask::Ptr, IoQueueListAllocator>;
44 using TaskListIter = TaskList::iterator;
45
46 IoQueue();
47
48 IoQueue(const Configuration& config,
49 std::vector<IoQueue>* sharedIoQueues);
50
51 IoQueue(const IoQueue& other);
52
53 IoQueue(IoQueue&& other) = default;
54
55 ~IoQueue();
56
57 void terminate() final;
58
59 void pinToCore(int coreId) final;
60
61 void run() final;
62
63 void enqueue(ITask::Ptr task) final;
64
65 bool tryEnqueue(ITask::Ptr task) final;
66
67 ITask::Ptr dequeue(std::atomic_bool& hint) final;
68
69 ITask::Ptr tryDequeue(std::atomic_bool& hint) final;
70
71 size_t size() const final;
72
73 bool empty() const final;
74
75 IQueueStatistics& stats() final;
76
77 SpinLock& getLock() final;
78
79 void signalEmptyCondition(bool value) final;
80
81 bool isIdle() const final;
82
83 const std::shared_ptr<std::thread>& getThread() const final;
84
85private:
86 ITask::Ptr grabWorkItem();
87 ITask::Ptr grabWorkItemFromAll();
88 void doEnqueue(ITask::Ptr task);
89 ITask::Ptr doDequeue(std::atomic_bool& hint);
90 ITask::Ptr tryDequeueFromShared();
91 std::chrono::milliseconds getBackoffInterval();
92
93 //async IO queue
94 std::vector<IoQueue>* _sharedIoQueues;
95 bool _loadBalanceSharedIoQueues;
96 std::chrono::milliseconds _loadBalancePollIntervalMs;
97 Configuration::BackoffPolicy _loadBalancePollIntervalBackoffPolicy;

Callers 1

DispatcherCoreMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected