Rename scrcpy threads
Prefix the name of threads by "scrcpy-". This improves readability in the output of `top -H` for example. Limit the thread names to 16 bytes, because it is limited on some platforms.
This commit is contained in:
parent
09c55b0f93
commit
3ada5c51bc
12 changed files with 19 additions and 13 deletions
|
@ -373,7 +373,7 @@ bool
|
|||
sc_aoa_start(struct sc_aoa *aoa) {
|
||||
LOGD("Starting AOA thread");
|
||||
|
||||
bool ok = sc_thread_create(&aoa->thread, run_aoa_thread, "aoa_thread", aoa);
|
||||
bool ok = sc_thread_create(&aoa->thread, run_aoa_thread, "scrcpy-aoa", aoa);
|
||||
if (!ok) {
|
||||
LOGC("Could not start AOA thread");
|
||||
return false;
|
||||
|
|
|
@ -110,7 +110,7 @@ controller_start(struct controller *controller) {
|
|||
LOGD("Starting controller thread");
|
||||
|
||||
bool ok = sc_thread_create(&controller->thread, run_controller,
|
||||
"controller", controller);
|
||||
"scrcpy-ctl", controller);
|
||||
if (!ok) {
|
||||
LOGC("Could not start controller thread");
|
||||
return false;
|
||||
|
|
|
@ -154,7 +154,7 @@ file_handler_start(struct file_handler *file_handler) {
|
|||
LOGD("Starting file_handler thread");
|
||||
|
||||
bool ok = sc_thread_create(&file_handler->thread, run_file_handler,
|
||||
"file_handler", file_handler);
|
||||
"scrcpy-file", file_handler);
|
||||
if (!ok) {
|
||||
LOGC("Could not start file_handler thread");
|
||||
return false;
|
||||
|
|
|
@ -108,7 +108,7 @@ fps_counter_start(struct fps_counter *counter) {
|
|||
// same thread, no need to lock
|
||||
if (!counter->thread_started) {
|
||||
bool ok = sc_thread_create(&counter->thread, run_fps_counter,
|
||||
"fps counter", counter);
|
||||
"scrcpy-fps", counter);
|
||||
if (!ok) {
|
||||
LOGE("Could not start FPS counter thread");
|
||||
return false;
|
||||
|
|
|
@ -111,8 +111,8 @@ bool
|
|||
receiver_start(struct receiver *receiver) {
|
||||
LOGD("Starting receiver thread");
|
||||
|
||||
bool ok = sc_thread_create(&receiver->thread, run_receiver, "receiver",
|
||||
receiver);
|
||||
bool ok = sc_thread_create(&receiver->thread, run_receiver,
|
||||
"scrcpy-receiver", receiver);
|
||||
if (!ok) {
|
||||
LOGC("Could not start receiver thread");
|
||||
return false;
|
||||
|
|
|
@ -287,7 +287,7 @@ recorder_open(struct recorder *recorder, const AVCodec *input_codec) {
|
|||
}
|
||||
|
||||
LOGD("Starting recorder thread");
|
||||
ok = sc_thread_create(&recorder->thread, run_recorder, "recorder",
|
||||
ok = sc_thread_create(&recorder->thread, run_recorder, "scrcpy-recorder",
|
||||
recorder);
|
||||
if (!ok) {
|
||||
LOGC("Could not start recorder thread");
|
||||
|
|
|
@ -804,7 +804,8 @@ error_connection_failed:
|
|||
|
||||
bool
|
||||
sc_server_start(struct sc_server *server) {
|
||||
bool ok = sc_thread_create(&server->thread, run_server, "server", server);
|
||||
bool ok =
|
||||
sc_thread_create(&server->thread, run_server, "scrcpy-server", server);
|
||||
if (!ok) {
|
||||
LOGE("Could not create server thread");
|
||||
return false;
|
||||
|
|
|
@ -284,7 +284,8 @@ bool
|
|||
stream_start(struct stream *stream) {
|
||||
LOGD("Starting stream thread");
|
||||
|
||||
bool ok = sc_thread_create(&stream->thread, run_stream, "stream", stream);
|
||||
bool ok =
|
||||
sc_thread_create(&stream->thread, run_stream, "scrcpy-stream", stream);
|
||||
if (!ok) {
|
||||
LOGC("Could not start stream thread");
|
||||
return false;
|
||||
|
|
|
@ -64,7 +64,7 @@ sc_process_observer_init(struct sc_process_observer *observer, sc_pid pid,
|
|||
observer->listener_userdata = listener_userdata;
|
||||
observer->terminated = false;
|
||||
|
||||
ok = sc_thread_create(&observer->thread, run_observer, "process_observer",
|
||||
ok = sc_thread_create(&observer->thread, run_observer, "scrcpy-proc",
|
||||
observer);
|
||||
if (!ok) {
|
||||
sc_cond_destroy(&observer->cond_terminated);
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
bool
|
||||
sc_thread_create(sc_thread *thread, sc_thread_fn fn, const char *name,
|
||||
void *userdata) {
|
||||
// The thread name length is limited on some systems. Never use a name
|
||||
// longer than 16 bytes (including the final '\0')
|
||||
assert(strlen(name) <= 15);
|
||||
|
||||
SDL_Thread *sdl_thread = SDL_CreateThread(fn, name, userdata);
|
||||
if (!sdl_thread) {
|
||||
LOG_OOM();
|
||||
|
|
|
@ -272,7 +272,7 @@ sc_v4l2_sink_open(struct sc_v4l2_sink *vs) {
|
|||
vs->stopped = false;
|
||||
|
||||
LOGD("Starting v4l2 thread");
|
||||
ok = sc_thread_create(&vs->thread, run_v4l2_sink, "v4l2", vs);
|
||||
ok = sc_thread_create(&vs->thread, run_v4l2_sink, "scrcpy-v4l2", vs);
|
||||
if (!ok) {
|
||||
LOGC("Could not start v4l2 thread");
|
||||
goto error_av_packet_free;
|
||||
|
|
|
@ -170,7 +170,7 @@ bool
|
|||
sc_video_buffer_start(struct sc_video_buffer *vb) {
|
||||
if (vb->buffering_time) {
|
||||
bool ok =
|
||||
sc_thread_create(&vb->b.thread, run_buffering, "buffering", vb);
|
||||
sc_thread_create(&vb->b.thread, run_buffering, "scrcpy-vbuf", vb);
|
||||
if (!ok) {
|
||||
LOGE("Could not start buffering thread");
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue