Skip to content

Commit 23b9817

Browse files
committed
Enable priority inheritance for mutexes
1 parent 7a72c55 commit 23b9817

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

libogc/lwp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,9 @@ s32 LWP_SetThreadPriority(lwp_t thethread,u8 prio)
371371

372372
old_prio = __lwp_priofromcore(lwp_thread->real_prio);
373373
lwp_thread->real_prio = __lwp_priotocore(prio);
374-
__lwp_thread_changepriority(lwp_thread,lwp_thread->real_prio,TRUE);
374+
375+
if(lwp_thread->res_cnt==0 || lwp_thread->cur_prio>lwp_thread->real_prio)
376+
__lwp_thread_changepriority(lwp_thread,lwp_thread->real_prio,TRUE);
375377
__lwp_thread_dispatchenable();
376378

377379
return old_prio;

libogc/mutex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
2828
mutex.c -- Thread subsystem III
2929
30-
Copyright (C) 2004 - 2025
30+
Copyright (C) 2004 - 2026
3131
Michael Wiedenbauer (shagkur)
3232
Dave Murphy (WinterMute)
3333
Extrems' Corner.org
@@ -149,7 +149,7 @@ s32 LWP_MutexInit(mutex_t *mutex,bool use_recursive)
149149
ret = __lwp_mutex_allocate();
150150
if(!ret) return EAGAIN;
151151

152-
attr.mode = LWP_MUTEX_FIFO;
152+
attr.mode = LWP_MUTEX_INHERITPRIO;
153153
attr.nest_behavior = (use_recursive)?LWP_MUTEX_NEST_ACQUIRE:LWP_MUTEX_NEST_ERROR;
154154
attr.onlyownerrelease = TRUE;
155155
attr.prioceil = LWP_PRIO_MIN + 1;

0 commit comments

Comments
 (0)