Common/Tests: Address Feedback
This commit is contained in:
parent
3398f701ee
commit
1f7dd36499
9 changed files with 51 additions and 39 deletions
|
@ -32,13 +32,12 @@ void __stdcall Fiber::FiberStartFunc(void* fiber_parameter) {
|
|||
}
|
||||
|
||||
Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter)
|
||||
: guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter},
|
||||
previous_fiber{} {
|
||||
: entry_point{std::move(entry_point_func)}, start_parameter{start_parameter} {
|
||||
impl = std::make_unique<FiberImpl>();
|
||||
impl->handle = CreateFiber(0, &FiberStartFunc, this);
|
||||
}
|
||||
|
||||
Fiber::Fiber() : guard{}, entry_point{}, start_parameter{}, previous_fiber{} {
|
||||
Fiber::Fiber() {
|
||||
impl = std::make_unique<FiberImpl>();
|
||||
}
|
||||
|
||||
|
|
|
@ -67,10 +67,10 @@ private:
|
|||
|
||||
struct FiberImpl;
|
||||
|
||||
SpinLock guard;
|
||||
std::function<void(void*)> entry_point;
|
||||
void* start_parameter;
|
||||
std::shared_ptr<Fiber> previous_fiber;
|
||||
SpinLock guard{};
|
||||
std::function<void(void*)> entry_point{};
|
||||
void* start_parameter{};
|
||||
std::shared_ptr<Fiber> previous_fiber{};
|
||||
std::unique_ptr<FiberImpl> impl;
|
||||
bool is_thread_fiber{};
|
||||
};
|
||||
|
|
|
@ -35,8 +35,9 @@ void thread_pause() {
|
|||
namespace Common {
|
||||
|
||||
void SpinLock::lock() {
|
||||
while (lck.test_and_set(std::memory_order_acquire))
|
||||
while (lck.test_and_set(std::memory_order_acquire)) {
|
||||
thread_pause();
|
||||
}
|
||||
}
|
||||
|
||||
void SpinLock::unlock() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue