1 #include "caffe2/utils/threadpool/pthreadpool.h" 2 #include "caffe2/utils/threadpool/ThreadPool.h" 9 void pthreadpool_compute_1d(
10 pthreadpool_t threadpool,
11 pthreadpool_function_1d_t
function,
14 if (threadpool ==
nullptr) {
17 for (
size_t i = 0; i < range; i++) {
18 function(argument, i);
24 [
function, argument](
int threadId,
size_t workId) {
25 function(argument, workId);
30 size_t pthreadpool_get_threads_count(pthreadpool_t threadpool) {
34 pthreadpool_t pthreadpool_create(
size_t threads_count) {
35 std::mutex thread_pool_creation_mutex_;
36 std::lock_guard<std::mutex> guard(thread_pool_creation_mutex_);
41 void pthreadpool_destroy(pthreadpool_t pthreadpool) {