Commit c6f2955d authored by Xavier Thompson's avatar Xavier Thompson

Rename _stealables into _potential

parent 440c6b05
......@@ -39,7 +39,7 @@ namespace typon
{
uint id = fdt::random::random() % get()._concurrency;
get()._worker[id].add(new Stack(task));
get()._stealables.fetch_add(1);
get()._potential.fetch_add(1);
get()._notifyer.notify_one();
}
......@@ -69,13 +69,13 @@ namespace typon
{
uint id = fdt::random::random() % get()._concurrency;
get()._worker[id].add(stack);
get()._stealables.fetch_add(1);
get()._potential.fetch_add(1);
}
get()._notifyer.notify_one();
}
std::atomic<uint> _thieves = 0;
std::atomic<u64> _stealables = 0;
std::atomic<u64> _potential = 0;
std::vector<Worker> _worker;
std::vector<std::thread> _thread;
std::atomic_bool _done {false};
......@@ -91,7 +91,7 @@ namespace typon
for (uint i = 0; i < concurrency; i++)
{
_worker[i]._gc = &(_gc);
_worker[i]._stealables = &(_stealables);
_worker[i]._potential = &(_potential);
}
thread_id = concurrency;
......@@ -168,7 +168,7 @@ namespace typon
}
if (_thieves.fetch_sub(1) == 1)
{
if (_stealables.load() > 0)
if (_potential.load() > 0)
{
_notifyer.cancel_wait();
continue;
......
......@@ -47,7 +47,7 @@ namespace typon
std::mutex _mutex;
std::atomic<Stack *> _stack {nullptr};
std::vector<Stack *> _pool;
std::atomic_uint_fast64_t * _stealables;
std::atomic_uint_fast64_t * _potential;
fdt::lock_free::garbage_collector * _gc;
~Worker()
......@@ -97,7 +97,7 @@ namespace typon
{
_gc->retire(stack);
}
_stealables->fetch_add(1);
_potential->fetch_add(1);
work._stack->resume();
}
else
......@@ -106,12 +106,12 @@ namespace typon
{
_stack.store(new Stack());
}
_stealables->fetch_add(1);
_potential->fetch_add(1);
work._task.resume();
}
if (_stack.load())
{
_stealables->fetch_sub(1);
_potential->fetch_sub(1);
}
}
......@@ -184,7 +184,7 @@ namespace typon
{
return stack;
}
_stealables->fetch_sub(1);
_potential->fetch_sub(1);
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