workPool: don't use std::function
it's kinda slow
This commit is contained in:
parent
084cbcb168
commit
9b276e80f8
7 changed files with 45 additions and 20 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue