Pithikos / C-Thread-Pool

A minimal but powerful thread pool in ANSI C
MIT License
2.06k stars 603 forks source link

How to keep track of number of running threads? #45

Closed RSH2000 closed 7 years ago

RSH2000 commented 7 years ago

In may be a request for enhancement rather than an issue, but , is there a way to keep track of number of active threads at each time?

X= thpool->num_threads_working; gives me the following error:

Myprog.c:872:40: error: dereferencing pointer to incomplete type ‘struct thpool_’ X=thpool->num_threads_working;

Thanks,

Pithikos commented 7 years ago

I had a look at this and with commit @48ae25d35a83febdff1b921acc5e41c71a60fda7 you should be able and do that now. However you need to follow the API.

In your case:

X=thpool_num_threads_working(thpool);
RSH2000 commented 7 years ago

Thanks for the quick enhancement! That worked great.