Changeset 1109
- Timestamp:
- Dec 10, 2011, 4:53:21 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r1093 r1109 55 55 [ --enable-experimental experimental build (default no)]) 56 56 57 AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h fastmath.h )57 AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h fastmath.h pthread.h) 58 58 59 59 if test "${enable_debug}" = "yes"; then -
trunk/src/thread/threadbase.h
r1105 r1109 17 17 #define __LOL_THREADBASE_H__ 18 18 19 #if defined __linux__ || defined __native_client__19 #if defined HAVE_PTHREAD_H 20 20 # include <pthread.h> 21 21 #elif defined _WIN32 … … 33 33 MutexBase() 34 34 { 35 #if defined __linux__ || defined __native_client__35 #if defined HAVE_PTHREAD_H 36 36 pthread_mutex_init(&m_mutex, NULL); 37 37 #elif defined _WIN32 … … 42 42 ~MutexBase() 43 43 { 44 #if defined __linux__ || defined __native_client__44 #if defined HAVE_PTHREAD_H 45 45 pthread_mutex_destroy(&m_mutex); 46 46 #elif defined _WIN32 … … 51 51 void Lock() 52 52 { 53 #if defined __linux__ || defined __native_client__53 #if defined HAVE_PTHREAD_H 54 54 pthread_mutex_lock(&m_mutex); 55 55 #elif defined _WIN32 … … 60 60 void Unlock() 61 61 { 62 #if defined __linux__ || defined __native_client__62 #if defined HAVE_PTHREAD_H 63 63 pthread_mutex_unlock(&m_mutex); 64 64 #elif defined _WIN32 … … 68 68 69 69 private: 70 #if defined __linux__ || defined __native_client__70 #if defined HAVE_PTHREAD_H 71 71 pthread_mutex_t m_mutex; 72 72 #elif defined _WIN32 … … 81 81 { 82 82 m_start = m_count = 0; 83 #if defined __linux__ || defined __native_client__83 #if defined HAVE_PTHREAD_H 84 84 m_poppers = m_pushers = 0; 85 85 pthread_mutex_init(&m_mutex, NULL); … … 95 95 ~QueueBase() 96 96 { 97 #if defined __linux__ || defined __native_client__97 #if defined HAVE_PTHREAD_H 98 98 pthread_cond_destroy(&m_empty_cond); 99 99 pthread_cond_destroy(&m_full_cond); … … 108 108 void Push(int value) 109 109 { 110 #if defined __linux__ || defined __native_client__110 #if defined HAVE_PTHREAD_H 111 111 pthread_mutex_lock(&m_mutex); 112 112 /* If queue is full, wait on the "full" cond var. */ … … 124 124 m_count++; 125 125 126 #if defined __linux__ || defined __native_client__126 #if defined HAVE_PTHREAD_H 127 127 /* If there were poppers waiting, signal the "empty" cond var. */ 128 128 if (m_poppers) … … 137 137 int Pop() 138 138 { 139 #if defined __linux__ || defined __native_client__139 #if defined HAVE_PTHREAD_H 140 140 pthread_mutex_lock(&m_mutex); 141 141 /* Wait until there is something in the queue. Be careful, we … … 156 156 m_count--; 157 157 158 #if defined __linux__ || defined __native_client__158 #if defined HAVE_PTHREAD_H 159 159 /* If there were pushers waiting, signal the "full" cond var. */ 160 160 if (m_pushers) … … 173 173 int m_values[CAPACITY]; 174 174 size_t m_start, m_count; 175 #if defined __linux__ || defined __native_client__175 #if defined HAVE_PTHREAD_H 176 176 size_t m_poppers, m_pushers; 177 177 pthread_mutex_t m_mutex; … … 188 188 ThreadBase(void *(*fn)(void *), void *data) 189 189 { 190 #if defined __linux__ || defined __native_client__190 #if defined HAVE_PTHREAD_H 191 191 /* Set the joinable attribute for systems who don't play nice */ 192 192 pthread_attr_t attr; … … 202 202 virtual ~ThreadBase() 203 203 { 204 #if defined __linux__ || defined __native_client__204 #if defined HAVE_PTHREAD_H 205 205 pthread_join(m_thread, NULL); 206 206 #elif defined _WIN32 … … 210 210 211 211 private: 212 #if defined __linux__ || defined __native_client__212 #if defined HAVE_PTHREAD_H 213 213 pthread_t m_thread; 214 214 #elif defined _WIN32
Note: See TracChangeset
for help on using the changeset viewer.