Skip to content

Commit

Permalink
thread: fix thread_create_name ENOMEM
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Jul 31, 2022
1 parent 05aa4e4 commit 0de6506
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/thread/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,18 @@ int mutex_alloc(mtx_t **mtx)
int thread_create_name(thrd_t *thr, const char *name, thrd_start_t func,
void *arg)
{
int err;
(void)name;

if (!thr || !func)
return EINVAL;

return (thrd_create(thr, func, arg) == thrd_success) ? 0 : EAGAIN;
err = thrd_create(thr, func, arg);
if (err == thrd_success)
return 0;

if (err == thrd_nomem)
return ENOMEM;

return EAGAIN;
}

0 comments on commit 0de6506

Please sign in to comment.