summaryrefslogtreecommitdiffstats
path: root/src/common/threadsafe_queue.h
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-02-13 04:12:23 +0100
committerLioncash <mathew1800@gmail.com>2019-02-13 04:39:53 +0100
commit0829ef97cac6cb96c49d1401433d9f46639bfeb8 (patch)
tree4001843b442ce4066635537596213a9e16aaefad /src/common/threadsafe_queue.h
parentthreadsafe_queue: Remove NeedSize template parameter (diff)
downloadyuzu-0829ef97cac6cb96c49d1401433d9f46639bfeb8.tar
yuzu-0829ef97cac6cb96c49d1401433d9f46639bfeb8.tar.gz
yuzu-0829ef97cac6cb96c49d1401433d9f46639bfeb8.tar.bz2
yuzu-0829ef97cac6cb96c49d1401433d9f46639bfeb8.tar.lz
yuzu-0829ef97cac6cb96c49d1401433d9f46639bfeb8.tar.xz
yuzu-0829ef97cac6cb96c49d1401433d9f46639bfeb8.tar.zst
yuzu-0829ef97cac6cb96c49d1401433d9f46639bfeb8.zip
Diffstat (limited to '')
-rw-r--r--src/common/threadsafe_queue.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h
index 2660b118a..f553efdc9 100644
--- a/src/common/threadsafe_queue.h
+++ b/src/common/threadsafe_queue.h
@@ -7,11 +7,10 @@
// a simple lockless thread-safe,
// single reader, single writer queue
-#include <algorithm>
#include <atomic>
#include <cstddef>
#include <mutex>
-#include "common/common_types.h"
+#include <utility>
namespace Common {
template <typename T>
@@ -25,7 +24,7 @@ public:
delete read_ptr;
}
- u32 Size() const {
+ std::size_t Size() const {
return size.load();
}
@@ -87,7 +86,7 @@ private:
// and a pointer to the next ElementPtr
class ElementPtr {
public:
- ElementPtr() : next(nullptr) {}
+ ElementPtr() {}
~ElementPtr() {
ElementPtr* next_ptr = next.load();
@@ -96,12 +95,12 @@ private:
}
T current;
- std::atomic<ElementPtr*> next;
+ std::atomic<ElementPtr*> next{nullptr};
};
ElementPtr* write_ptr;
ElementPtr* read_ptr;
- std::atomic<u32> size{0};
+ std::atomic_size_t size{0};
};
// a simple thread-safe,
@@ -110,7 +109,7 @@ private:
template <typename T>
class MPSCQueue {
public:
- u32 Size() const {
+ std::size_t Size() const {
return spsc_queue.Size();
}