aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarat Dukhan <marat@fb.com>2017-12-27 17:02:08 -0800
committerMarat Dukhan <marat@fb.com>2017-12-27 17:03:04 -0800
commit7d77d72beda99d49ea57ff0b438f8f0db1ef756a (patch)
tree05b094f62b2750489596c009d3471f34185b03db
parentf7c1b3bcff4403ddfc182a79e472fe2741683612 (diff)
downloadplatform_external_pthreadpool-7d77d72beda99d49ea57ff0b438f8f0db1ef756a.tar.gz
platform_external_pthreadpool-7d77d72beda99d49ea57ff0b438f8f0db1ef756a.tar.bz2
platform_external_pthreadpool-7d77d72beda99d49ea57ff0b438f8f0db1ef756a.zip
pthreadpool_get_threads_count: support NULL threadpool
-rw-r--r--src/threadpool-pthreads.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/threadpool-pthreads.c b/src/threadpool-pthreads.c
index f7d4dfb..ff0817e 100644
--- a/src/threadpool-pthreads.c
+++ b/src/threadpool-pthreads.c
@@ -368,7 +368,11 @@ struct pthreadpool* pthreadpool_create(size_t threads_count) {
}
size_t pthreadpool_get_threads_count(struct pthreadpool* threadpool) {
- return threadpool->threads_count;
+ if (threadpool == NULL) {
+ return 1;
+ } else {
+ return threadpool->threads_count;
+ }
}
void pthreadpool_compute_1d(