Return -1 from CurrentThreadId when called by thread outside the pool.

This commit is contained in:
Rasmus Munk Larsen
2016-06-23 16:40:07 -07:00
parent d39df320d2
commit a9c1e4d7b7
5 changed files with 14 additions and 11 deletions

View File

@@ -28,7 +28,7 @@ static void test_parallelism()
const int kThreads = 16; // code below expects that this is a multiple of 4
NonBlockingThreadPool tp(kThreads);
VERIFY_IS_EQUAL(tp.NumThreads(), kThreads);
VERIFY_IS_EQUAL(tp.CurrentThreadId(), kThreads);
VERIFY_IS_EQUAL(tp.CurrentThreadId(), -1);
for (int iter = 0; iter < 100; ++iter) {
std::atomic<int> running(0);
std::atomic<int> done(0);