mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	thread: name all threads so that the names appear in /proc/$PID/task/$TID/comm
This commit is contained in:
		
							parent
							
								
									5248a584a3
								
							
						
					
					
						commit
						cdc2769162
					
				
					 23 changed files with 80 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -1929,7 +1929,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
			
		|||
 | 
			
		||||
    pa_alsa_dump(PA_LOG_DEBUG, u->pcm_handle);
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("alsa-sink", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1750,7 +1750,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
			
		|||
 | 
			
		||||
    pa_alsa_dump(PA_LOG_DEBUG, u->pcm_handle);
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("alsa-source", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2046,7 +2046,7 @@ static int start_thread(struct userdata *u) {
 | 
			
		|||
    }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("bluetooth", thread_func, u))) {
 | 
			
		||||
        pa_log_error("Failed to create IO thread");
 | 
			
		||||
        stop_thread(u);
 | 
			
		||||
        return -1;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -197,6 +197,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
 | 
			
		|||
    return pa_sink_process_msg(o, code, data, offset, memchunk);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* JACK Callback: This is called when JACK needs some data */
 | 
			
		||||
static int jack_process(jack_nframes_t nframes, void *arg) {
 | 
			
		||||
    struct userdata *u = arg;
 | 
			
		||||
    unsigned c;
 | 
			
		||||
| 
						 | 
				
			
			@ -250,6 +251,7 @@ finish:
 | 
			
		|||
    pa_log_debug("Thread shutting down");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* JACK Callback: This is called when JACK triggers an error */
 | 
			
		||||
static void jack_error_func(const char*t) {
 | 
			
		||||
    char *s;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -258,6 +260,7 @@ static void jack_error_func(const char*t) {
 | 
			
		|||
    pa_xfree(s);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* JACK Callback: This is called when JACK is set up */
 | 
			
		||||
static void jack_init(void *arg) {
 | 
			
		||||
    struct userdata *u = arg;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -267,6 +270,7 @@ static void jack_init(void *arg) {
 | 
			
		|||
        pa_make_realtime(u->core->realtime_priority+4);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* JACK Callback: This is called when JACK kicks us */
 | 
			
		||||
static void jack_shutdown(void* arg) {
 | 
			
		||||
    struct userdata *u = arg;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -274,6 +278,7 @@ static void jack_shutdown(void* arg) {
 | 
			
		|||
    pa_asyncmsgq_post(u->jack_msgq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_ON_SHUTDOWN, NULL, 0, NULL, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* JACK Callback: This is called when JACK changes the buffer size */
 | 
			
		||||
static int jack_buffer_size(jack_nframes_t nframes, void *arg) {
 | 
			
		||||
    struct userdata *u = arg;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -413,7 +418,7 @@ int pa__init(pa_module*m) {
 | 
			
		|||
    jack_set_thread_init_callback(u->client, jack_init, u);
 | 
			
		||||
    jack_set_buffer_size_callback(u->client, jack_buffer_size, u);
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("jack-sink", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -363,7 +363,7 @@ int pa__init(pa_module*m) {
 | 
			
		|||
    jack_on_shutdown(u->client, jack_shutdown, u);
 | 
			
		||||
    jack_set_thread_init_callback(u->client, jack_init, u);
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("jack-source", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1304,7 +1304,7 @@ int pa__init(pa_module*m) {
 | 
			
		|||
    u->sink_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_UNLINK], PA_HOOK_EARLY, (pa_hook_cb_t) sink_unlink_hook_cb, u);
 | 
			
		||||
    u->sink_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_state_changed_hook_cb, u);
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("combine", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -628,7 +628,7 @@ int pa__init(pa_module*m) {
 | 
			
		|||
    /* Reserve space for the response */
 | 
			
		||||
    u->read_data = pa_xmalloc(u->read_length = sizeof(int32_t));
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("esound-sink", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -317,7 +317,7 @@ int pa__init(pa_module*m) {
 | 
			
		|||
    pa_sink_set_max_rewind(u->sink, nbytes);
 | 
			
		||||
    pa_sink_set_max_request(u->sink, nbytes);
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("null-sink", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -311,7 +311,7 @@ int pa__init(pa_module*m) {
 | 
			
		|||
    pollfd->fd = u->fd;
 | 
			
		||||
    pollfd->events = pollfd->revents = 0;
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("pipe-sink", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -295,7 +295,7 @@ int pa__init(pa_module*m) {
 | 
			
		|||
    pollfd->fd = u->fd;
 | 
			
		||||
    pollfd->events = pollfd->revents = 0;
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("pipe-source", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -274,7 +274,7 @@ int pa__init(pa_module*m) {
 | 
			
		|||
    pa_source_set_rtpoll(u->source, u->rtpoll);
 | 
			
		||||
    pa_source_set_fixed_latency(u->source, u->block_usec);
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("sine-source", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2014,7 +2014,7 @@ int pa__init(pa_module*m) {
 | 
			
		|||
    u->fragsize = (uint32_t) -1;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("module-tunnel", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1456,7 +1456,7 @@ go_on:
 | 
			
		|||
 | 
			
		||||
    pa_memchunk_reset(&u->memchunk);
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("oss", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -620,7 +620,7 @@ int pa__init(pa_module*m) {
 | 
			
		|||
    pa_raop_client_set_callback(u->raop, on_connection, u);
 | 
			
		||||
    pa_raop_client_set_closed_callback(u->raop, on_close, u);
 | 
			
		||||
 | 
			
		||||
    if (!(u->thread = pa_thread_new(thread_func, u))) {
 | 
			
		||||
    if (!(u->thread = pa_thread_new("raop-sink", thread_func, u))) {
 | 
			
		||||
        pa_log("Failed to create thread.");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue