thread: implement some properties

Make helper method to parse thread properties and add 2 new properties
to control name and stack-size of the thread.
Use properties when creating threads with the default utils.
Use the default thread utils instead of pthread_create so that the
properties are used.
This commit is contained in:
Wim Taymans 2022-04-18 13:02:27 +02:00
parent 5f7421b946
commit 0b96b87331
7 changed files with 93 additions and 46 deletions

View file

@ -2508,14 +2508,13 @@ static struct spa_thread *impl_create(void *object,
pw_log_info("create thread");
if (globals.creator != NULL) {
pthread_t pt;
pthread_attr_t attributes;
pthread_attr_t *attr = NULL, attributes;
pthread_attr_init(&attributes);
CHECK(pthread_attr_setstacksize(&attributes, THREAD_STACK), error);
attr = pw_thread_fill_attr(props, &attributes);
res = -globals.creator(&pt, &attributes, start, arg);
pthread_attr_destroy(&attributes);
res = -globals.creator(&pt, attr, start, arg);
if (attr)
pthread_attr_destroy(attr);
if (res != 0)
goto error;
thr = (struct spa_thread*)pt;