Chromium Code Reviews| Index: native_client_sdk/src/libraries/sdk_util/thread_pool.cc |
| diff --git a/native_client_sdk/src/libraries/sdk_util/thread_pool.cc b/native_client_sdk/src/libraries/sdk_util/thread_pool.cc |
| index e7d2e5cb6b295e6f8ce3fcc4599453073a41b898..1a2d2b8d29218a7006077cb053cf0402e271cba9 100644 |
| --- a/native_client_sdk/src/libraries/sdk_util/thread_pool.cc |
| +++ b/native_client_sdk/src/libraries/sdk_util/thread_pool.cc |
| @@ -60,15 +60,7 @@ void ThreadPool::Setup(int counter, WorkFunction work, void *data) { |
| // Return decremented task counter. This function |
| // can be called from multiple threads at any given time. |
| int ThreadPool::DecCounter() { |
| -#if defined(__native_client__) |
| - // Use fast atomic sub & fetch. |
| - return __sync_sub_and_fetch(&counter_, 1); |
| -#else |
| - // Fallback to a more platform independent pthread mutex via AutoLock. |
| - static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; |
| - AutoLock lock(&mutex); |
| - return --counter_; |
| -#endif |
| + return AtomicAddFetch(&counter_, 1); |
|
nfullagar1
2013/07/18 00:18:06
This should return the decremented task counter, b
|
| } |
| // Set exit flag, post and join all the threads in the pool. This function is |