/*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2017-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/// not implement a blocking interface. For the purposes of this
/// class, lower number is higher priority
-template <class T>
+template <
+ typename T,
+ template <typename> class Atom = std::atomic,
+ bool Dynamic = false>
class PriorityMPMCQueue {
public:
PriorityMPMCQueue(size_t numPriorities, size_t capacity) {
return false;
}
+ bool readWithPriority(T& item, size_t priority) {
+ return queues_[priority].readIfNotEmpty(item);
+ }
+
size_t size() const {
size_t total_size = 0;
for (auto& q : queues_) {
}
private:
- std::vector<folly::MPMCQueue<T>> queues_;
+ std::vector<folly::MPMCQueue<T, Atom, Dynamic>> queues_;
};
} // namespace folly