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
195195 return WELS_THREAD_ERROR_OK;
196196 }
197197
198+WELS_THREAD_ERROR_CODE WelsThreadSetName (const char* thread_name) {
199+ // do nothing
200+ return WELS_THREAD_ERROR_OK;
201+}
202+
203+
198204 WELS_THREAD_ERROR_CODE WelsThreadJoin (WELS_THREAD_HANDLE thread) {
199205 WaitForSingleObject (thread, INFINITE);
200206 CloseHandle (thread);
@@ -242,6 +248,17 @@ WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_ · 41 unmodified lines
242248 return err;
243249 }
244250
251+WELS_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+
245262 WELS_THREAD_ERROR_CODE WelsThreadJoin (WELS_THREAD_HANDLE thread) {
246263 return pthread_join (thread, NULL);
247264 }

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