Skip to content

Commit bf5cb9f

Browse files
committed
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 <[email protected]>
1 parent 30f5dfb commit bf5cb9f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

rproc.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,12 @@ static void *do_rproc_start(void *unused)
187187

188188
int rproc_start()
189189
{
190-
return pthread_create(&start_thread, NULL, do_rproc_start, NULL);
190+
pthread_attr_t attr;
191+
192+
pthread_attr_init(&attr);
193+
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
194+
195+
return pthread_create(&start_thread, &attr, do_rproc_start, NULL);
191196
}
192197

193198
static void *do_rproc_stop(void *unused)
@@ -211,5 +216,10 @@ static void *do_rproc_stop(void *unused)
211216

212217
int rproc_stop(void)
213218
{
214-
return pthread_create(&stop_thread, NULL, do_rproc_stop, NULL);
219+
pthread_attr_t attr;
220+
221+
pthread_attr_init(&attr);
222+
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
223+
224+
return pthread_create(&stop_thread, &attr, do_rproc_stop, NULL);
215225
}

0 commit comments

Comments
 (0)