From df18a9f970e4eabd2c6fa880df8db5ae3c804d69 Mon Sep 17 00:00:00 2001 From: jcorporation Date: Mon, 21 Jan 2019 00:20:48 +0000 Subject: [PATCH] Fix: set threadnames --- src/main.c | 5 +++++ src/mympd_api.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 949f38f..4278e3d 100644 --- a/src/main.c +++ b/src/main.c @@ -22,6 +22,8 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#define _GNU_SOURCE + #include #include #include @@ -280,10 +282,13 @@ int main(int argc, char **argv) { pthread_t mpd_client_thread, web_server_thread, mympd_api_thread; //mpd connection pthread_create(&mpd_client_thread, NULL, mpd_client_loop, &config); + pthread_setname_np(mpd_client_thread, "mympd_mpdclient"); //webserver pthread_create(&web_server_thread, NULL, web_server_loop, &mgr); + pthread_setname_np(web_server_thread, "mympd_webserver"); //mympd api pthread_create(&mympd_api_thread, NULL, mympd_api_loop, &config); + pthread_setname_np(mympd_api_thread, "mympd_mympdapi"); //Outsourced all work to separate threads, do nothing... diff --git a/src/mympd_api.c b/src/mympd_api.c index e99796c..ca34e5b 100644 --- a/src/mympd_api.c +++ b/src/mympd_api.c @@ -100,7 +100,7 @@ void *mympd_api_loop(void *arg_config) { } while (s_signal_received == 0) { - struct t_work_request *request = tiny_queue_shift(mympd_api_queue, 100); + struct t_work_request *request = tiny_queue_shift(mympd_api_queue, 0); if (request != NULL) { mympd_api(config, &mympd_state, request); }