workPool: don't use std::function

it's kinda slow
This commit is contained in:
tildearrow 2023-09-07 00:16:47 -05:00
parent 084cbcb168
commit 9b276e80f8
7 changed files with 45 additions and 20 deletions

View file

@ -71,7 +71,7 @@ void DivWorkThread::run() {
}
}
bool DivWorkThread::assign(const std::function<void(void*)>& what, void* arg) {
bool DivWorkThread::assign(void (*what)(void*), void* arg) {
lock.lock();
if (tasks.size()>=30) {
lock.unlock();
@ -105,7 +105,7 @@ void DivWorkThread::init(DivWorkPool* p) {
thread=new std::thread(_workThread,this);
}
void DivWorkPool::push(const std::function<void(void*)>& what, void* arg) {
void DivWorkPool::push(void (*what)(void*), void* arg) {
// if no work threads, just execute
if (!threaded) {
what(arg);