Commit ebf375d2 authored by Xavier Thompson's avatar Xavier Thompson

Rename _stealables into _potential

parent 89b06540
...@@ -39,7 +39,7 @@ namespace typon ...@@ -39,7 +39,7 @@ namespace typon
{ {
uint id = fdt::random::random() % get()._concurrency; uint id = fdt::random::random() % get()._concurrency;
get()._worker[id].add(new Stack(task)); get()._worker[id].add(new Stack(task));
get()._stealables.fetch_add(1); get()._potential.fetch_add(1);
get()._notifyer.notify_one(); get()._notifyer.notify_one();
} }
...@@ -69,13 +69,13 @@ namespace typon ...@@ -69,13 +69,13 @@ namespace typon
{ {
uint id = fdt::random::random() % get()._concurrency; uint id = fdt::random::random() % get()._concurrency;
get()._worker[id].add(stack); get()._worker[id].add(stack);
get()._stealables.fetch_add(1); get()._potential.fetch_add(1);
} }
get()._notifyer.notify_one(); get()._notifyer.notify_one();
} }
std::atomic<uint> _thieves = 0; std::atomic<uint> _thieves = 0;
std::atomic<u64> _stealables = 0; std::atomic<u64> _potential = 0;
std::vector<Worker> _worker; std::vector<Worker> _worker;
std::vector<std::thread> _thread; std::vector<std::thread> _thread;
std::atomic_bool _done {false}; std::atomic_bool _done {false};
...@@ -91,7 +91,7 @@ namespace typon ...@@ -91,7 +91,7 @@ namespace typon
for (uint i = 0; i < concurrency; i++) for (uint i = 0; i < concurrency; i++)
{ {
_worker[i]._gc = &(_gc); _worker[i]._gc = &(_gc);
_worker[i]._stealables = &(_stealables); _worker[i]._potential = &(_potential);
} }
thread_id = concurrency; thread_id = concurrency;
...@@ -168,7 +168,7 @@ namespace typon ...@@ -168,7 +168,7 @@ namespace typon
} }
if (_thieves.fetch_sub(1) == 1) if (_thieves.fetch_sub(1) == 1)
{ {
if (_stealables.load() > 0) if (_potential.load() > 0)
{ {
_notifyer.cancel_wait(); _notifyer.cancel_wait();
continue; continue;
......
...@@ -47,7 +47,7 @@ namespace typon ...@@ -47,7 +47,7 @@ namespace typon
std::mutex _mutex; std::mutex _mutex;
std::atomic<Stack *> _stack {nullptr}; std::atomic<Stack *> _stack {nullptr};
std::vector<Stack *> _pool; std::vector<Stack *> _pool;
std::atomic_uint_fast64_t * _stealables; std::atomic_uint_fast64_t * _potential;
fdt::lock_free::garbage_collector * _gc; fdt::lock_free::garbage_collector * _gc;
~Worker() ~Worker()
...@@ -97,7 +97,7 @@ namespace typon ...@@ -97,7 +97,7 @@ namespace typon
{ {
_gc->retire(stack); _gc->retire(stack);
} }
_stealables->fetch_add(1); _potential->fetch_add(1);
work._stack->resume(); work._stack->resume();
} }
else else
...@@ -106,12 +106,12 @@ namespace typon ...@@ -106,12 +106,12 @@ namespace typon
{ {
_stack.store(new Stack()); _stack.store(new Stack());
} }
_stealables->fetch_add(1); _potential->fetch_add(1);
work._task.resume(); work._task.resume();
} }
if (_stack.load()) if (_stack.load())
{ {
_stealables->fetch_sub(1); _potential->fetch_sub(1);
} }
} }
...@@ -184,7 +184,7 @@ namespace typon ...@@ -184,7 +184,7 @@ namespace typon
{ {
return stack; return stack;
} }
_stealables->fetch_sub(1); _potential->fetch_sub(1);
return {}; return {};
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment