History

add a thread name for easier profiling

Sijia Chen committed 12 years ago

Commit 41720f81 parent 195d1363 files · +21 −0Browse files

Showing the changes to codec/common/src/WelsThreadLib.cpp (1 of 3 files). Show all

Unified · Split

codec/common/src/WelsThreadLib.cpp+17−0
@@ -195,6 +195,12 @@ WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_ · 194 unmodified lines
195 return WELS_THREAD_ERROR_OK;195 return WELS_THREAD_ERROR_OK;
196}196}
197 197
198WELS_THREAD_ERROR_CODE WelsThreadSetName (const char* thread_name) {
199 // do nothing
200 return WELS_THREAD_ERROR_OK;
201}
202
203
198WELS_THREAD_ERROR_CODE WelsThreadJoin (WELS_THREAD_HANDLE thread) {204WELS_THREAD_ERROR_CODE WelsThreadJoin (WELS_THREAD_HANDLE thread) {
199 WaitForSingleObject (thread, INFINITE);205 WaitForSingleObject (thread, INFINITE);
200 CloseHandle (thread);206 CloseHandle (thread);
@@ -242,6 +248,17 @@ WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_ · 41 unmodified lines
242 return err;248 return err;
243}249}
244 250
251WELS_THREAD_ERROR_CODE WelsThreadSetName (const char* thread_name) {
252#ifdef APPLE_IOS
253 pthread_setname_np(thread_name);
254#endif
255#ifdef __ANDROID__
256 pthread_setname_np(pthread_self(), thread_name);
257#endif
258 // do nothing
259 return WELS_THREAD_ERROR_OK;
260}
261
245WELS_THREAD_ERROR_CODE WelsThreadJoin (WELS_THREAD_HANDLE thread) {262WELS_THREAD_ERROR_CODE WelsThreadJoin (WELS_THREAD_HANDLE thread) {
246 return pthread_join (thread, NULL);263 return pthread_join (thread, NULL);
247}264}

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