Skip to content
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: 7 additions & 3 deletions FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,21 @@ static void prvExitThread( void )
{
pthread_internal_t * pxThread = ( pthread_internal_t * ) pthread_self();

vTaskSuspendAll();

/* If this thread is joinable, wait for a call to pthread_join. */
if( pthreadIS_JOINABLE( pxThread->xAttr.usSchedPriorityDetachState ) )
{
( void ) xSemaphoreGive( ( SemaphoreHandle_t ) &pxThread->xJoinBarrier );
( void ) xTaskResumeAll();

/* Suspend until the call to pthread_join. The caller of pthread_join
* will perform cleanup. */
vTaskSuspend( NULL );
}
else
{
( void ) xTaskResumeAll();
/* For a detached thread, perform cleanup of thread object. */
vPortFree( pxThread );
vTaskDelete( NULL );
Expand Down Expand Up @@ -359,7 +363,7 @@ int pthread_create( pthread_t * thread,
}

/* End the critical section. */
xTaskResumeAll();
( void ) xTaskResumeAll();
}

return iStatus;
Expand Down Expand Up @@ -467,7 +471,7 @@ int pthread_join( pthread_t pthread,
vPortFree( pxThread );

/* End the critical section. */
xTaskResumeAll();
( void ) xTaskResumeAll();
}

return iStatus;
Expand Down Expand Up @@ -526,7 +530,7 @@ int pthread_detach(pthread_t pthread)
}

/* End the critical section. */
xTaskResumeAll();
( void ) xTaskResumeAll();
}

return iStatus;
Expand Down