mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-04 14:02:45 +01:00
common: bounded_threadsafe_queue: Use polyfill_thread.
This commit is contained in:
parent
889454f9bf
commit
0eb3fa05e5
1 changed files with 3 additions and 2 deletions
|
@ -9,10 +9,11 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <stop_token>
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "common/polyfill_thread.h"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
#if defined(__cpp_lib_hardware_interference_size)
|
#if defined(__cpp_lib_hardware_interference_size)
|
||||||
|
@ -78,7 +79,7 @@ public:
|
||||||
auto& slot = slots[idx(tail)];
|
auto& slot = slots[idx(tail)];
|
||||||
if (!slot.turn.test()) {
|
if (!slot.turn.test()) {
|
||||||
std::unique_lock lock{cv_mutex};
|
std::unique_lock lock{cv_mutex};
|
||||||
cv.wait(lock, stop, [&slot] { return slot.turn.test(); });
|
Common::CondvarWait(cv, lock, stop, [&slot] { return slot.turn.test(); });
|
||||||
}
|
}
|
||||||
v = slot.move();
|
v = slot.move();
|
||||||
slot.destroy();
|
slot.destroy();
|
||||||
|
|
Loading…
Reference in a new issue