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
121121 UINT__ CBufferAdvance::join( Chuck_Event * event )
122122 {
123123 // TODO: necessary?
124−// m_mutex.acquire();
124+ #ifndef __DISABLE_THREADS__
125+ m_mutex.acquire();
126+ #endif
125127
126128 // index of new pointer that will be pushed back
127129 UINT__ read_offset_index;
@@ -143,7 +145,9 @@ UINT__ CBufferAdvance::join( Chuck_Event * event ) · 15 unmodified lines
143145 }
144146
145147 // TODO: necessary?
146−// m_mutex.release();
148+ #ifndef __DISABLE_THREADS__
149+ m_mutex.release();
150+ #endif
147151
148152 // return index
149153 return read_offset_index;
@@ -161,7 +165,9 @@ void CBufferAdvance::resign( UINT__ read_offset_index ) · 11 unmodified lines
161165 return;
162166
163167 // TODO: necessary?
164−// m_mutex.acquire();
168+ #ifndef __DISABLE_THREADS__
169+ m_mutex.acquire();
170+ #endif
165171
166172 // add this index to free queue
167173 m_free.push( read_offset_index );
@@ -171,7 +177,9 @@ void CBufferAdvance::resign( UINT__ read_offset_index ) · 3 unmodified lines
171177 m_read_offsets[read_offset_index].event = NULL;
172178
173179 // TODO: necessary?
174−// m_mutex.release();
180+ #ifndef __DISABLE_THREADS__
181+ m_mutex.release();
182+ #endif
175183 }
176184
177185
@@ -208,7 +216,9 @@ void CBufferAdvance::put( void * data, UINT__ num_elem ) · 30 unmodified lines
208216 BYTE__ * d = (BYTE__ *)data;
209217
210218 // TODO: necessary?
211−// m_mutex.acquire();
219+ #ifndef __DISABLE_THREADS__
220+ m_mutex.acquire();
221+ #endif
212222
213223 // copy
214224 for( i = 0; i < num_elem; i++ )
@@ -240,7 +250,9 @@ void CBufferAdvance::put( void * data, UINT__ num_elem ) · 25 unmodified lines
240250 }
241251
242252 // TODO: necessary?
243−// m_mutex.release();
253+ #ifndef __DISABLE_THREADS__
254+ m_mutex.release();
255+ #endif
244256 }
245257
246258
@@ -308,17 +320,23 @@ UINT__ CBufferAdvance::get( void * data, UINT__ num_elem, UINT__ read_offset_ind · 61 unmodified lines
308320 BYTE__ * d = (BYTE__ *)data;
309321
310322 // TODO: necessary?
311−// m_mutex.acquire();
323+ #ifndef __DISABLE_THREADS__
324+ m_mutex.acquire();
325+ #endif
312326
313327 // make sure index is valid
314328 if( read_offset_index >= m_read_offsets.size() )
315329 {
316−// m_mutex.release();
330+ #ifndef __DISABLE_THREADS__
331+ m_mutex.release();
332+ #endif
317333 return 0;
318334 }
319335 if( m_read_offsets[read_offset_index].read_offset < 0 )
320336 {
321−// m_mutex.release();
337+ #ifndef __DISABLE_THREADS__
338+ m_mutex.release();
339+ #endif
322340 return 0;
323341 }
324342
@@ -327,7 +345,9 @@ UINT__ CBufferAdvance::get( void * data, UINT__ num_elem, UINT__ read_offset_ind · 2 unmodified lines
327345 // read catch up with write
328346 if( m_read_offset == m_write_offset )
329347 {
330−// m_mutex.release();
348+ #ifndef __DISABLE_THREADS__
349+ m_mutex.release();
350+ #endif
331351 return 0;
332352 }
333353
@@ -357,7 +377,9 @@ UINT__ CBufferAdvance::get( void * data, UINT__ num_elem, UINT__ read_offset_ind · 23 unmodified lines
357377 m_read_offsets[read_offset_index].read_offset = m_read_offset;
358378
359379 // TODO: necessary?
360−// m_mutex.release();
380+ #ifndef __DISABLE_THREADS__
381+ m_mutex.release();
382+ #endif
361383
362384 // return number of elems
363385 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