Skip to content

Commit

Permalink
recursion stopper for the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
travisgriggs committed Dec 16, 2017
1 parent 97e5a6d commit 2d8e8d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/tn_mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ static void _mutex_do_unlock(struct TN_Mutex * mutex)
*/
static void _update_holders_priority_recursive(struct TN_Task *task)
{
struct TN_Task *original = task;
struct TN_Task *holder;

in:
Expand All @@ -627,6 +628,11 @@ static void _update_holders_priority_recursive(struct TN_Task *task)
// points to the task which is/was holding the mutex.
holder = _get_mutex_by_wait_queque(task->pwait_queue)->holder;

//-- check for infinite recursion and exit if loop is detected
if (holder == original) {
return;
}

//-- now, `holder` points to the (ex-)holder, i.e. to the task which is/was
// holding the mutex. Now, we iterate through all the mutexes that are
// still held by (ex-)holder, determining new priority for (ex-)holder.
Expand Down

0 comments on commit 2d8e8d3

Please sign in to comment.