History

undo test commenting out code with preprocessor directives

Jack Atherton committed 7 years ago

Commit b91dd1e1 parent db1a1dd26 files · +7454 −7195Browse files

Showing the changes to src/core/util_buffers.cpp (1 of 26 files). Show all

Unified · Split

src/core/util_buffers.cpp+33−11
@@ -121,7 +121,9 @@ void CBufferAdvance::cleanup() · 120 unmodified lines
121UINT__ CBufferAdvance::join( Chuck_Event * event )121UINT__ CBufferAdvance::join( Chuck_Event * event )
122{122{
123 // TODO: necessary?123 // TODO: necessary?
124// m_mutex.acquire();124 #ifndef __DISABLE_THREADS__
125 m_mutex.acquire();
126 #endif
125 127
126 // index of new pointer that will be pushed back128 // index of new pointer that will be pushed back
127 UINT__ read_offset_index;129 UINT__ read_offset_index;
@@ -143,7 +145,9 @@ UINT__ CBufferAdvance::join( Chuck_Event * event ) · 15 unmodified lines
143 }145 }
144 146
145 // TODO: necessary?147 // TODO: necessary?
146// m_mutex.release();148 #ifndef __DISABLE_THREADS__
149 m_mutex.release();
150 #endif
147 151
148 // return index152 // return index
149 return read_offset_index;153 return read_offset_index;
@@ -161,7 +165,9 @@ void CBufferAdvance::resign( UINT__ read_offset_index ) · 11 unmodified lines
161 return;165 return;
162 166
163 // TODO: necessary?167 // TODO: necessary?
164// m_mutex.acquire();168 #ifndef __DISABLE_THREADS__
169 m_mutex.acquire();
170 #endif
165 171
166 // add this index to free queue172 // add this index to free queue
167 m_free.push( read_offset_index );173 m_free.push( read_offset_index );
@@ -171,7 +177,9 @@ void CBufferAdvance::resign( UINT__ read_offset_index ) · 3 unmodified lines
171 m_read_offsets[read_offset_index].event = NULL;177 m_read_offsets[read_offset_index].event = NULL;
172 178
173 // TODO: necessary?179 // TODO: necessary?
174// m_mutex.release();180 #ifndef __DISABLE_THREADS__
181 m_mutex.release();
182 #endif
175}183}
176 184
177 185
@@ -208,7 +216,9 @@ void CBufferAdvance::put( void * data, UINT__ num_elem ) · 30 unmodified lines
208 BYTE__ * d = (BYTE__ *)data;216 BYTE__ * d = (BYTE__ *)data;
209 217
210 // TODO: necessary?218 // TODO: necessary?
211// m_mutex.acquire();219 #ifndef __DISABLE_THREADS__
220 m_mutex.acquire();
221 #endif
212 222
213 // copy223 // copy
214 for( i = 0; i < num_elem; i++ )224 for( i = 0; i < num_elem; i++ )
@@ -240,7 +250,9 @@ void CBufferAdvance::put( void * data, UINT__ num_elem ) · 25 unmodified lines
240 }250 }
241 251
242 // TODO: necessary?252 // TODO: necessary?
243// m_mutex.release();253 #ifndef __DISABLE_THREADS__
254 m_mutex.release();
255 #endif
244}256}
245 257
246 258
@@ -308,17 +320,23 @@ UINT__ CBufferAdvance::get( void * data, UINT__ num_elem, UINT__ read_offset_ind · 61 unmodified lines
308 BYTE__ * d = (BYTE__ *)data;320 BYTE__ * d = (BYTE__ *)data;
309 321
310 // TODO: necessary?322 // TODO: necessary?
311// m_mutex.acquire();323 #ifndef __DISABLE_THREADS__
324 m_mutex.acquire();
325 #endif
312 326
313 // make sure index is valid327 // make sure index is valid
314 if( read_offset_index >= m_read_offsets.size() )328 if( read_offset_index >= m_read_offsets.size() )
315 {329 {
316// m_mutex.release();330 #ifndef __DISABLE_THREADS__
331 m_mutex.release();
332 #endif
317 return 0;333 return 0;
318 }334 }
319 if( m_read_offsets[read_offset_index].read_offset < 0 )335 if( m_read_offsets[read_offset_index].read_offset < 0 )
320 {336 {
321// m_mutex.release();337 #ifndef __DISABLE_THREADS__
338 m_mutex.release();
339 #endif
322 return 0;340 return 0;
323 }341 }
324 342
@@ -327,7 +345,9 @@ UINT__ CBufferAdvance::get( void * data, UINT__ num_elem, UINT__ read_offset_ind · 2 unmodified lines
327 // read catch up with write345 // read catch up with write
328 if( m_read_offset == m_write_offset )346 if( m_read_offset == m_write_offset )
329 {347 {
330// m_mutex.release();348 #ifndef __DISABLE_THREADS__
349 m_mutex.release();
350 #endif
331 return 0;351 return 0;
332 }352 }
333 353
@@ -357,7 +377,9 @@ UINT__ CBufferAdvance::get( void * data, UINT__ num_elem, UINT__ read_offset_ind · 23 unmodified lines
357 m_read_offsets[read_offset_index].read_offset = m_read_offset;377 m_read_offsets[read_offset_index].read_offset = m_read_offset;
358 378
359 // TODO: necessary?379 // TODO: necessary?
360// m_mutex.release();380 #ifndef __DISABLE_THREADS__
381 m_mutex.release();
382 #endif
361 383
362 // return number of elems384 // return number of elems
363 return i;385 return i;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t