Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

thread: thrd_error fixes #71

Merged
merged 2 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/aubuf/ajb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/aubuf/aubuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 7 additions & 3 deletions src/aumix/aumix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 10 additions & 7 deletions src/vidmix/vidmix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down