@@ -92,38 +92,38 @@ class BasicProactiveThreadpool {
9292};
9393
9494// Constructor
95- template < template <typename ...> class TaskType >
96- BasicProactiveThreadpool<TaskType >::BasicProactiveThreadpool(unsigned N){
95+ template < template <typename ...> class Func >
96+ BasicProactiveThreadpool<Func >::BasicProactiveThreadpool(unsigned N){
9797 spawn (N);
9898}
9999
100100// Destructor
101- template < template <typename ...> class TaskType >
102- BasicProactiveThreadpool<TaskType >::~BasicProactiveThreadpool (){
101+ template < template <typename ...> class Func >
102+ BasicProactiveThreadpool<Func >::~BasicProactiveThreadpool (){
103103 shutdown ();
104104}
105105
106106// Function: is_owner
107- template < template <typename ...> class TaskType >
108- bool BasicProactiveThreadpool<TaskType >::is_owner() const {
107+ template < template <typename ...> class Func >
108+ bool BasicProactiveThreadpool<Func >::is_owner() const {
109109 return std::this_thread::get_id () == _owner;
110110}
111111
112112// Function: num_tasks
113- template < template <typename ...> class TaskType >
114- size_t BasicProactiveThreadpool<TaskType >::num_tasks() const {
113+ template < template <typename ...> class Func >
114+ size_t BasicProactiveThreadpool<Func >::num_tasks() const {
115115 return _task_queue.size ();
116116}
117117
118118// Function: num_workers
119- template < template <typename ...> class TaskType >
120- size_t BasicProactiveThreadpool<TaskType >::num_workers() const {
119+ template < template <typename ...> class Func >
120+ size_t BasicProactiveThreadpool<Func >::num_workers() const {
121121 return _threads.size ();
122122}
123123
124124// Procedure: shutdown
125- template < template <typename ...> class TaskType >
126- void BasicProactiveThreadpool<TaskType >::shutdown() {
125+ template < template <typename ...> class Func >
126+ void BasicProactiveThreadpool<Func >::shutdown() {
127127
128128 if (!is_owner ()){
129129 throw std::runtime_error (" Worker thread cannot shut down the pool" );
@@ -170,8 +170,8 @@ void BasicProactiveThreadpool<TaskType>::shutdown() {
170170}
171171
172172// Procedure: spawn
173- template < template <typename ...> class TaskType >
174- void BasicProactiveThreadpool<TaskType >::spawn(unsigned N) {
173+ template < template <typename ...> class Func >
174+ void BasicProactiveThreadpool<Func >::spawn(unsigned N) {
175175
176176 if (!is_owner ()){
177177 throw std::runtime_error (" Worker thread cannot spawn threads" );
@@ -221,9 +221,9 @@ void BasicProactiveThreadpool<TaskType>::spawn(unsigned N) {
221221}
222222
223223// Procedure: silent_async
224- template < template <typename ...> class TaskType >
224+ template < template <typename ...> class Func >
225225template <typename C>
226- void BasicProactiveThreadpool<TaskType >::silent_async(C&& c){
226+ void BasicProactiveThreadpool<Func >::silent_async(C&& c){
227227
228228 TaskType t {std::forward<C>(c)};
229229
@@ -247,9 +247,9 @@ void BasicProactiveThreadpool<TaskType>::silent_async(C&& c){
247247}
248248
249249// Function: async
250- template < template <typename ...> class TaskType >
250+ template < template <typename ...> class Func >
251251template <typename C>
252- auto BasicProactiveThreadpool<TaskType >::async(C&& c) {
252+ auto BasicProactiveThreadpool<Func >::async(C&& c) {
253253
254254 using R = std::invoke_result_t <C>;
255255
@@ -316,8 +316,8 @@ auto BasicProactiveThreadpool<TaskType>::async(C&& c) {
316316}
317317
318318// Function: wait_for_all
319- template < template <typename ...> class TaskType >
320- void BasicProactiveThreadpool<TaskType >::wait_for_all() {
319+ template < template <typename ...> class Func >
320+ void BasicProactiveThreadpool<Func >::wait_for_all() {
321321
322322 if (!is_owner ()){
323323 throw std::runtime_error (" Worker thread cannot wait for all" );
@@ -333,11 +333,5 @@ void BasicProactiveThreadpool<TaskType>::wait_for_all() {
333333
334334}; // namespace proactive_threadpool -----------------------------------------
335335
336- namespace tf {
337-
338- using ProactiveThreadpool = proactive_threadpool::BasicProactiveThreadpool<std::function>;
339-
340- }; // namespace tf. ----------------------------------------------------------
341-
342336
343337
0 commit comments