diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2026-01-14 09:45:16 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-14 09:45:16 +0000 |
| commit | 42669b8acf4cb57b51cec30e04c43ff79777eb7d (patch) | |
| tree | 404efa51240012b03d536bf1eb9e60c95abf1cae | |
| parent | bbcbf243a1069eef67426a6b5ba3871e535fad2b (diff) | |
| parent | bd9d682d154ceb4b6d4a9b129eacce16757219b3 (diff) | |
Merge pull request #6133 from WongSoft/fix-low-priority-thread-unix
[core:thread] Ensure creating a low priority thread with SCHED_OTHER policy does not assert
| -rw-r--r-- | core/thread/thread_unix.odin | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/thread/thread_unix.odin b/core/thread/thread_unix.odin index e18ea593d..af2a4a3c1 100644 --- a/core/thread/thread_unix.odin +++ b/core/thread/thread_unix.odin @@ -107,7 +107,11 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread { high := posix.sched_get_priority_max(policy) switch priority { case .Normal: // Okay - case .Low: params.sched_priority = low + 1 + case .Low: + params.sched_priority = low + 1 + if params.sched_priority >= high { + params.sched_priority = low + } case .High: params.sched_priority = high } res = posix.pthread_attr_setschedparam(&attrs, ¶ms) |