Caffe2 - C++ API
A deep learning, cross platform ML framework
pthreadpool_impl.cc
1 
17 #include "caffe2/utils/threadpool/pthreadpool.h"
18 #include "caffe2/utils/threadpool/pthreadpool_impl.h"
19 #include "caffe2/utils/threadpool/ThreadPool.h"
20 
21 
22 //
23 // External API
24 //
25 
26 void pthreadpool_compute_1d(struct pthreadpool* threadpool,
27  pthreadpool_function_1d_t function,
28  void* argument,
29  size_t range) {
30  threadpool->pool_->run(
31  [function, argument](int threadId, size_t workId) {
32  function(argument, workId);
33  },
34  range);
35 }
36 
37 size_t pthreadpool_get_threads_count(struct pthreadpool* threadpool) {
38  return threadpool->pool_->getNumThreads();
39 }