diff options
author | Miao Wang <miaowang@google.com> | 2018-02-23 11:33:20 -0800 |
---|---|---|
committer | Miao Wang <miaowang@google.com> | 2018-02-23 11:40:25 -0800 |
commit | 7d0d5a611e629e7c8946e6720baa6846ade9f015 (patch) | |
tree | a6ece8759b2fc774b39edea08417e08fa633a73c /profiling/pthread_everywhere.h | |
parent | 8a6b22a5d1f7db709938f33ad5f836dc3aaa7e31 (diff) | |
download | gemmlowp-7d0d5a611e629e7c8946e6720baa6846ade9f015.tar.gz |
Rebase gemmlowp to ecae4d1android-wear-p-preview-2android-p-preview-5android-p-preview-4android-p-preview-3android-p-preview-2android-p-preview-1android-o-mr1-iot-release-1.0.2android-o-mr1-iot-release-1.0.1android-o-mr1-iot-release-1.0.0android-o-mr1-iot-preview-8android-o-mr1-iot-preview-7android-n-iot-release-smart-display-r2android-n-iot-release-smart-displayandroid-n-iot-release-polk-at1android-n-iot-release-lg-thinq-wk7o-mr1-iot-preview-8o-mr1-iot-preview-7
Test: mm
Test: NeuralNetworksTests pass
Change-Id: I2acafc240269ed81997a3a9d06321cbc2ca5e528
Diffstat (limited to 'profiling/pthread_everywhere.h')
-rw-r--r-- | profiling/pthread_everywhere.h | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/profiling/pthread_everywhere.h b/profiling/pthread_everywhere.h index 7e12d66..df17c6f 100644 --- a/profiling/pthread_everywhere.h +++ b/profiling/pthread_everywhere.h @@ -18,8 +18,6 @@ #ifndef GEMMLOWP_PROFILING_PTHREAD_EVERYWHERE_H_ #define GEMMLOWP_PROFILING_PTHREAD_EVERYWHERE_H_ -#include "pthread_everywhere.h" - #ifndef _WIN32 #define GEMMLOWP_USE_PTHREAD #endif @@ -39,39 +37,29 @@ // structs; ours take nullptr_t. That is because gemmlowp always passes // nullptr at the moment, so any support we would code for non-null // attribs would be unused. -#include <thread> -#include <mutex> #include <condition_variable> #include <cstddef> +#include <mutex> +#include <thread> namespace gemmlowp { -using pthread_t = std::thread*; -using pthread_mutex_t = std::mutex*; -using pthread_cond_t = std::condition_variable*; -inline void pthread_create(pthread_t* thread, std::nullptr_t, - void *(*start_routine) (void *), void *arg) { +using pthread_t = std::thread *; +using pthread_mutex_t = std::mutex *; +using pthread_cond_t = std::condition_variable *; +inline void pthread_create(pthread_t *thread, std::nullptr_t, + void *(*start_routine)(void *), void *arg) { *thread = new std::thread(start_routine, arg); } -inline void pthread_join(pthread_t thread, std::nullptr_t) { - thread->join(); -} +inline void pthread_join(pthread_t thread, std::nullptr_t) { thread->join(); } inline void pthread_mutex_init(pthread_mutex_t *mutex, std::nullptr_t) { *mutex = new std::mutex; } -inline void pthread_mutex_lock(pthread_mutex_t* mutex) { - (*mutex)->lock(); -} -inline void pthread_mutex_unlock(pthread_mutex_t* mutex) { - (*mutex)->unlock(); -} -inline void pthread_mutex_destroy(pthread_mutex_t *mutex) { - delete *mutex; -} +inline void pthread_mutex_lock(pthread_mutex_t *mutex) { (*mutex)->lock(); } +inline void pthread_mutex_unlock(pthread_mutex_t *mutex) { (*mutex)->unlock(); } +inline void pthread_mutex_destroy(pthread_mutex_t *mutex) { delete *mutex; } inline void pthread_cond_init(pthread_cond_t *cond, std::nullptr_t) { *cond = new std::condition_variable; } -inline void pthread_cond_signal(pthread_cond_t* cond) { - (*cond)->notify_one(); -} +inline void pthread_cond_signal(pthread_cond_t *cond) { (*cond)->notify_one(); } inline void pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) { std::unique_lock<std::mutex> lock(**mutex, std::adopt_lock); (*cond)->wait(lock); @@ -79,10 +67,8 @@ inline void pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) { // the lock is not released lock.release(); } -inline void pthread_cond_destroy(pthread_cond_t *cond) { - delete *cond; -} +inline void pthread_cond_destroy(pthread_cond_t *cond) { delete *cond; } } // end namespace gemmlowp #endif -#endif // GEMMLOWP_PROFILING_PTHREAD_EVERYWHERE_H_
\ No newline at end of file +#endif // GEMMLOWP_PROFILING_PTHREAD_EVERYWHERE_H_ |