diff --git a/src/aubuf/ajb.c b/src/aubuf/ajb.c index 832818d..bc5f50d 100644 --- a/src/aubuf/ajb.c +++ b/src/aubuf/ajb.c @@ -144,7 +144,7 @@ struct ajb *ajb_alloc(double silence) if (!ajb) return NULL; - err = mtx_alloc(&ajb->lock); + err = mutex_alloc(&ajb->lock); if (err) goto out; diff --git a/src/aubuf/aubuf.c b/src/aubuf/aubuf.c index 0c0207e..2741e06 100644 --- a/src/aubuf/aubuf.c +++ b/src/aubuf/aubuf.c @@ -125,7 +125,7 @@ int aubuf_alloc(struct aubuf **abp, size_t min_sz, size_t max_sz) if (!ab) return ENOMEM; - err = mtx_alloc(&ab->lock); + err = mutex_alloc(&ab->lock); if (err) goto out; diff --git a/src/aumix/aumix.c b/src/aumix/aumix.c index eaa7182..f2f01b3 100644 --- a/src/aumix/aumix.c +++ b/src/aumix/aumix.c @@ -224,16 +224,20 @@ int aumix_alloc(struct aumix **mixp, uint32_t srate, mix->ch = ch; err = mtx_init(&mix->mutex, mtx_plain); - if (err) + if (err != thrd_success) { + err = ENOMEM; goto out; + } err = cnd_init(&mix->cond); - if (err) + if (err != thrd_success) { + err = ENOMEM; goto out; + } mix->run = true; - err = thrd_create(&mix->thread, aumix_thread, mix); + err = thread_create_name(&mix->thread, "aumix", aumix_thread, mix); if (err) { mix->run = false; goto out; diff --git a/src/vidmix/vidmix.c b/src/vidmix/vidmix.c index b83a202..2b43486 100644 --- a/src/vidmix/vidmix.c +++ b/src/vidmix/vidmix.c @@ -335,8 +335,10 @@ int vidmix_alloc(struct vidmix **mixp) return ENOMEM; err = mtx_init(&mix->rwlock, mtx_plain); - if (err) + if (err != thrd_success) { + err = ENOMEM; goto out; + } mix->initialized = true; @@ -384,8 +386,10 @@ int vidmix_source_alloc(struct vidmix_source **srcp, struct vidmix *mix, src->arg = arg; err = mtx_init(&src->mutex, mtx_plain); - if (err) + if (err != thrd_success) { + err = ENOMEM; goto out; + } if (sz) { err = vidframe_alloc(&src->frame_tx, VID_FMT_YUV420P, sz); @@ -498,12 +502,11 @@ int vidmix_source_start(struct vidmix_source *src) src->run = true; - err = thrd_create(&src->thread, - src->content ? content_thread : vidmix_thread, - src); - if (err) { + err = thread_create_name(&src->thread, "vidmix", + src->content ? content_thread : vidmix_thread, + src); + if (err) src->run = false; - } return err; }