rproc: Make start & stop threads detached

We're not joining the start and stop threads, so create them in detached
state to avoid having their resources lingering.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Bjorn Andersson 2020-12-07 08:42:05 -08:00
parent 30f5dfb890
commit bf5cb9faf2

14
rproc.c
View File

@ -187,7 +187,12 @@ static void *do_rproc_start(void *unused)
int rproc_start() int rproc_start()
{ {
return pthread_create(&start_thread, NULL, do_rproc_start, NULL); pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
return pthread_create(&start_thread, &attr, do_rproc_start, NULL);
} }
static void *do_rproc_stop(void *unused) static void *do_rproc_stop(void *unused)
@ -211,5 +216,10 @@ static void *do_rproc_stop(void *unused)
int rproc_stop(void) int rproc_stop(void)
{ {
return pthread_create(&stop_thread, NULL, do_rproc_stop, NULL); pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
return pthread_create(&stop_thread, &attr, do_rproc_stop, NULL);
} }