aboutsummaryrefslogtreecommitdiff
path: root/profiling/pthread_everywhere.h
diff options
context:
space:
mode:
Diffstat (limited to 'profiling/pthread_everywhere.h')
-rw-r--r--profiling/pthread_everywhere.h42
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_