History

stripped extraneous whitespace from src/

used the following commands: find . -type f -name "*.h" | xargs sed -i 's/\s*$//g' find . -type f -name "*.cpp" | xargs sed -i 's/\s*$//g'

nshaheed committed 4 years ago

Commit e27927b1 parent f4eeefe90 files · +7646 −7646Browse files

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

Unified · Split

src/core/util_thread.cpp+30−30
@@ -102,7 +102,7 @@ XThread::~XThread( ) · 101 unmodified lines
102102 bool XThread::start( THREAD_FUNCTION routine, void * ptr )
103103 {
104104 bool result = false;
105−
105+
106106 #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) )
107107 if( pthread_create( &thread, NULL, *routine, ptr ) == 0 )
108108 result = true;
@@ -124,7 +124,7 @@ bool XThread::start( THREAD_FUNCTION routine, void * ptr ) · 15 unmodified lines
124124 bool XThread::wait( long milliseconds, bool cancel )
125125 {
126126 bool result = false;
127−
127+
128128 // TODO: find an alternative for Android?
129129 #if( defined(__PLATFORM_MACOSX__) || ( defined(__PLATFORM_LINUX__) && !defined(__ANDROID__) ) || defined(__WINDOWS_PTHREAD__) )
130130 // cancel the thread?
@@ -174,7 +174,7 @@ XMutex::XMutex( ) · 43 unmodified lines
174174 pthread_mutex_init(&mutex, NULL);
175175 #elif defined(__PLATFORM_WIN32__)
176176 InitializeCriticalSection(&mutex);
177−#endif
177+#endif
178178 }
179179
180180
@@ -190,7 +190,7 @@ XMutex::~XMutex( ) · 9 unmodified lines
190190 pthread_mutex_destroy( &mutex );
191191 #elif defined(__PLATFORM_WIN32__)
192192 DeleteCriticalSection(&mutex);
193−#endif
193+#endif
194194 }
195195
196196
@@ -206,7 +206,7 @@ void XMutex::acquire( ) · 9 unmodified lines
206206 pthread_mutex_lock(&mutex);
207207 #elif defined(__PLATFORM_WIN32__)
208208 EnterCriticalSection(&mutex);
209−#endif
209+#endif
210210 }
211211
212212
@@ -222,7 +222,7 @@ void XMutex::release( ) · 9 unmodified lines
222222 pthread_mutex_unlock(&mutex);
223223 #elif defined(__PLATFORM_WIN32__)
224224 LeaveCriticalSection(&mutex);
225−#endif
225+#endif
226226 }
227227
228228
@@ -239,7 +239,7 @@ XWriteThread * XWriteThread::shared() · 10 unmodified lines
239239 // check
240240 if( o_defaultWriteThread == NULL )
241241 o_defaultWriteThread = new XWriteThread();
242−
242+
243243 return o_defaultWriteThread;
244244 }
245245
@@ -290,7 +290,7 @@ void XWriteThread::shutdown() · 44 unmodified lines
290290 Message msg;
291291 msg.operation = Message::SHUTDOWN;
292292 m_msg_buffer->put( msg );
293−
293+
294294 // smart log push
295295 SmartPushLog logPush;
296296
@@ -313,19 +313,19 @@ size_t XWriteThread::fwrite(const void * ptr, size_t size, size_t nitems, FILE * · 16 unmodified lines
313313 {
314314 if(stream != m_stream)
315315 flush_data_buffer();
316−
316+
317317 // TODO: overflow detection
318318 if(m_data_buffer->put((char*)ptr, size*nitems) == 0)
319319 {
320320 EM_log(CK_LOG_SEVERE, "XWriteThread::fwrite: data buffer overflow");
321321 }
322−
322+
323323 m_bytes_in_buffer += size*nitems;
324324 m_stream = stream;
325−
325+
326326 if(m_bytes_in_buffer >= PRODUCER_BUFFER_SIZE)
327327 flush_data_buffer();
328−
328+
329329 return nitems;
330330 }
331331
@@ -339,14 +339,14 @@ size_t XWriteThread::fwrite(const void * ptr, size_t size, size_t nitems, FILE * · 7 unmodified lines
339339 int XWriteThread::fseek(FILE *stream, long offset, int whence)
340340 {
341341 flush_data_buffer();
342−
342+
343343 Message msg;
344344 msg.file = stream;
345345 msg.operation = Message::SEEK;
346346 msg.seek.offset = offset;
347347 msg.seek.whence = whence;
348348 m_msg_buffer->put(msg);
349−
349+
350350 return 0;
351351 }
352352
@@ -360,12 +360,12 @@ int XWriteThread::fseek(FILE *stream, long offset, int whence) · 7 unmodified lines
360360 int XWriteThread::fflush(FILE *stream)
361361 {
362362 flush_data_buffer();
363−
363+
364364 Message msg;
365365 msg.file = stream;
366366 msg.operation = Message::FLUSH;
367367 m_msg_buffer->put(msg);
368−
368+
369369 return 0;
370370 }
371371
@@ -379,12 +379,12 @@ int XWriteThread::fflush(FILE *stream) · 7 unmodified lines
379379 int XWriteThread::fclose(FILE *stream)
380380 {
381381 flush_data_buffer();
382−
382+
383383 Message msg;
384384 msg.file = stream;
385385 msg.operation = Message::CLOSE;
386386 m_msg_buffer->put(msg);
387−
387+
388388 return 0;
389389 }
390390
@@ -404,7 +404,7 @@ void XWriteThread::flush_data_buffer() · 13 unmodified lines
404404 msg.operation = Message::WRITE;
405405 msg.write.data_size = m_bytes_in_buffer;
406406 m_msg_buffer->put(msg);
407−
407+
408408 m_bytes_in_buffer = 0;
409409 }
410410 }
@@ -424,7 +424,7 @@ unsigned XWriteThread::write_cb(void * _thiss) · 13 unmodified lines
424424 {
425425 XWriteThread * _this = (XWriteThread *) _thiss;
426426 Message msg;
427−
427+
428428 while(!_this->m_thread_exit)
429429 {
430430 while(_this->m_msg_buffer->get(msg))
@@ -438,7 +438,7 @@ unsigned XWriteThread::write_cb(void * _thiss) · 7 unmodified lines
438438 EM_log(CK_LOG_SEVERE, "XWriteThread: buffered data size mismatch (%li : %li)",
439439 msg.write.data_size, actual_size);
440440 }
441−
441+
442442 ::fwrite(_this->m_thread_buffer, 1, actual_size, msg.file);
443443 }
444444 else if(msg.operation == Message::SEEK)
@@ -459,13 +459,13 @@ unsigned XWriteThread::write_cb(void * _thiss) · 14 unmodified lines
459459 break;
460460 }
461461 }
462−
462+
463463 usleep(1000);
464464 }
465−
465+
466466 delete _this;
467467 _thiss = _this = NULL;
468−
468+
469469 return 0;
470470 }
471471
@@ -490,14 +490,14 @@ t_CKBOOL XThreadUtil::set_priority( CHUCK_THREAD tid, t_CKINT priority ) · 18 unmodified lines
490490 {
491491 struct sched_param param;
492492 int policy;
493−
493+
494494 // log
495495 EM_log( CK_LOG_INFO, "setting thread priority to: %ld...", priority );
496−
496+
497497 // get for thread
498498 if( pthread_getschedparam( tid, &policy, &param) )
499499 return FALSE;
500−
500+
501501 // pthread_attr_t attr;
502502 // pthread_attr_init( &attr );
503503 // pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
@@ -550,14 +550,14 @@ t_CKBOOL XThreadUtil::set_priority( CHUCK_THREAD tid, t_CKINT priority ) · 46 unmodified lines
550550 {
551551 // if priority is 0 then done
552552 if( !priority ) return TRUE;
553−
553+
554554 // log
555555 EM_log( CK_LOG_FINE, "setting thread priority to: %ld...", priority );
556−
556+
557557 // set the priority the thread, windows style
558558 if( !SetThreadPriority( tid, priority ) )
559559 return FALSE;
560−
560+
561561 return TRUE;
562562 }
563563 //-----------------------------------------------------------------------------

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