mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
thread: make it possible to set a custom create function
Make a property to pass a custom function pointer to create threads instead of pthread_create. Use this in jack instead of bypassing the thread utils create function, which gives the wrong thread rt priority with rtkit. Fixes #4099
This commit is contained in:
parent
7114e9a31a
commit
0f08f54ef3
3 changed files with 24 additions and 20 deletions
|
|
@ -65,10 +65,16 @@ static struct spa_thread *impl_create(void *object,
|
|||
pthread_attr_t *attr = NULL, attributes;
|
||||
const char *str;
|
||||
int err;
|
||||
int (*create_func)(pthread_t *, const pthread_attr_t *attr, void *(*start)(void*), void *) = NULL;
|
||||
|
||||
attr = pw_thread_fill_attr(props, &attributes);
|
||||
|
||||
err = pthread_create(&pt, attr, start, arg);
|
||||
if (props == NULL ||
|
||||
(str = spa_dict_lookup(props, SPA_KEY_THREAD_CREATOR)) == NULL ||
|
||||
sscanf(str, "pointer:%p", &create_func) != 1)
|
||||
create_func = pthread_create;
|
||||
|
||||
err = create_func(&pt, attr, start, arg);
|
||||
|
||||
if (attr)
|
||||
pthread_attr_destroy(attr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue