diff options
author | Moritz Pflanzer <moritz.pflanzer@arm.com> | 2017-09-08 11:55:31 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | ba0f8dd10a2d99e167c3ef0e0335765d04f62f10 (patch) | |
tree | bb5916dc38bdceecec06b138f0cf05d2683440fa /src | |
parent | c186b574e52b81c75e551cee46a6c4cc7d500c90 (diff) | |
download | ComputeLibrary-ba0f8dd10a2d99e167c3ef0e0335765d04f62f10.tar.gz |
COMPMID-417: Fix thread allocation in CPPScheduler
Change-Id: I04848b834f56ba5371a685d00f9bdd0f38addb6e
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/87029
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/runtime/CPP/CPPScheduler.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtime/CPP/CPPScheduler.cpp b/src/runtime/CPP/CPPScheduler.cpp index 9cc3f033c2..a8382b42bf 100644 --- a/src/runtime/CPP/CPPScheduler.cpp +++ b/src/runtime/CPP/CPPScheduler.cpp @@ -165,7 +165,7 @@ CPPScheduler &CPPScheduler::get() CPPScheduler::CPPScheduler() : _num_threads(std::thread::hardware_concurrency()), - _threads(std::unique_ptr<Thread[], void(*)(Thread *)>(new Thread[std::thread::hardware_concurrency() - 1], delete_threads)) + _threads(std::unique_ptr<Thread[], void(*)(Thread *)>(new Thread[_num_threads - 1], delete_threads)) { } @@ -173,6 +173,7 @@ void CPPScheduler::set_num_threads(unsigned int num_threads) { const unsigned int num_cores = std::thread::hardware_concurrency(); _num_threads = num_threads == 0 ? num_cores : num_threads; + _threads.reset(new Thread[_num_threads - 1]); } unsigned int CPPScheduler::num_threads() const |