Files
pytorch/caffe2/utils/threadpool/pthreadpool_impl.cc
2016-11-15 00:00:46 -08:00

27 lines
719 B
C++

#include "caffe2/utils/threadpool/pthreadpool.h"
#include "caffe2/utils/threadpool/pthreadpool_impl.h"
#include "caffe2/utils/threadpool/ThreadPool.h"
#if CAFFE2_THREADPOOL_MOBILE
//
// External API
//
void pthreadpool_compute_1d(struct pthreadpool* threadpool,
pthreadpool_function_1d_t function,
void* argument,
size_t range) {
threadpool->pool_->run(
[function, argument](int threadId, size_t workId) {
function(argument, workId);
},
range);
}
size_t pthreadpool_get_threads_count(struct pthreadpool* threadpool) {
return threadpool->pool_->getNumThreads();
}
#endif // CAFFE2_THREADPOOL_MOBILE