mirror of
https://github.com/vanilla-wiiu/vanilla.git
synced 2026-10-28 09:43:51 +00:00
name all threads
This commit is contained in:
1 parent
9252f39336
commit
5f34f63dc9
5 files changed
+27
-2
No files matched your search
@@ -232,9 +232,16 @@ int connect_as_gamepad_internal(event_loop_t *event_loop, uint32_t server_addres
|
||||
pthread_t video_thread, audio_thread, input_thread, msg_thread, cmd_thread;
|
||||
|
||||
pthread_create(&video_thread, NULL, listen_video, &info);
|
||||
name_thread(video_thread, "vanilla-video");
|
||||
|
||||
pthread_create(&audio_thread, NULL, listen_audio, &info);
|
||||
name_thread(audio_thread, "vanilla-audio");
|
||||
|
||||
pthread_create(&input_thread, NULL, listen_input, &info);
|
||||
name_thread(input_thread, "vanilla-input");
|
||||
|
||||
pthread_create(&cmd_thread, NULL, listen_command, &info);
|
||||
name_thread(cmd_thread, "vanilla-cmd");
|
||||
|
||||
while (1) {
|
||||
usleep(250 * 1000);
|
||||
|
||||
+16
@@ -1,5 +1,6 @@
|
||||
#include "util.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -62,3 +63,18 @@ uint16_t crc16(const void *data, size_t len)
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
static int (*ppthread_setname_np)(pthread_t, const char*) = NULL;
|
||||
static int checked_for_pthread_setname_np = 0;
|
||||
void name_thread(pthread_t thread, const char *name)
|
||||
{
|
||||
if (!checked_for_pthread_setname_np) {
|
||||
void *fn = dlsym(RTLD_DEFAULT, "pthread_setname_np");
|
||||
ppthread_setname_np = (int(*)(pthread_t, const char*)) fn;
|
||||
checked_for_pthread_setname_np = 1;
|
||||
}
|
||||
|
||||
if (ppthread_setname_np) {
|
||||
ppthread_setname_np(thread, name);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ int is_interrupted();
|
||||
void force_interrupt();
|
||||
void install_interrupt_handler();
|
||||
void uninstall_interrupt_handler();
|
||||
void name_thread(pthread_t thread, const char *name);
|
||||
|
||||
uint16_t crc16(const void* data, size_t len);
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ int vanilla_start_internal(uint32_t server_address)
|
||||
|
||||
// Start other thread (which will set event loop to active)
|
||||
pthread_create(&other, NULL, start_gamepad, data);
|
||||
name_thread(other, "vanilla-gamepad");
|
||||
|
||||
// Wait for event loop to be set active before returning
|
||||
while (!event_loop.active) {
|
||||
|
||||
Reference in new issue
Block a user