Changeset 1144
- Timestamp:
- Feb 25, 2012, 2:38:42 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/thread/thread.h
r1098 r1144 32 32 }; 33 33 34 class Queue : public QueueBase 34 template<typename T, int N = 128> class Queue : public QueueBase<T, N> 35 35 { 36 36 public: 37 Queue() : QueueBase () {}37 Queue() : QueueBase<T, N>() {} 38 38 }; 39 39 -
trunk/src/thread/threadbase.h
r1109 r1144 75 75 }; 76 76 77 class QueueBase77 template<typename T, int N> class QueueBase 78 78 { 79 79 public: … … 106 106 } 107 107 108 void Push( intvalue)108 void Push(T value) 109 109 { 110 110 #if defined HAVE_PTHREAD_H … … 135 135 } 136 136 137 intPop()137 T Pop() 138 138 { 139 139 #if defined HAVE_PTHREAD_H … … 152 152 153 153 /* Pop value */ 154 intret = m_values[m_start];154 T ret = m_values[m_start]; 155 155 m_start = (m_start + 1) % CAPACITY; 156 156 m_count--; … … 170 170 171 171 private: 172 static size_t const CAPACITY = 100;173 intm_values[CAPACITY];172 static size_t const CAPACITY = N; 173 T m_values[CAPACITY]; 174 174 size_t m_start, m_count; 175 175 #if defined HAVE_PTHREAD_H -
trunk/src/ticker.cpp
r1125 r1144 76 76 static void *DiskThreadMain(void *p); 77 77 Thread *gamethread, *drawthread, *diskthread; 78 Queue gametick, drawtick;78 Queue<int> gametick, drawtick; 79 79 80 80 /* Shutdown management */ -
trunk/test/tutorial/tut03.cpp
r1136 r1144 770 770 /* Worker threads */ 771 771 Thread *m_threads[MAX_THREADS]; 772 Queue m_spawnqueue, m_jobqueue, m_donequeue;772 Queue<int> m_spawnqueue, m_jobqueue, m_donequeue; 773 773 774 774 /* Debug information */
Note: See TracChangeset
for help on using the changeset viewer.