Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing mutex unlock at early exit rtThreadPool #236

Merged
Merged
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
10 changes: 8 additions & 2 deletions src/rtmessage/rtThreadPool.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,10 @@ rtError rtThreadPool_RunTask(rtThreadPool pool, rtThreadPoolFunc func, void* use
{
task = rt_try_malloc(sizeof(struct _rtThreadTask));
if(!task)
return rtErrorFromErrno(ENOMEM);
{
pthread_mutex_unlock(&pool->poolLock);
return rtErrorFromErrno(ENOMEM);
}
rtLog_Debug("taskList data null so alloc new %p", (void*)task);
rtListItem_SetData(item, task);
}
Expand All @@ -321,7 +324,10 @@ rtError rtThreadPool_RunTask(rtThreadPool pool, rtThreadPoolFunc func, void* use
{
rtLog_Debug("%s creating new thread", __FUNCTION__);
if((err = rtThreadPool_CreateWorkerThread(pool)) != RT_OK)
return err;
{
pthread_mutex_unlock(&pool->poolLock);
return err;
}
if(pool->threadCount == pool->maxThreadCount - 1)
rtLog_Debug("%s reached max thread count %zu", __FUNCTION__, pool->maxThreadCount);
}
Expand Down
Loading