bitwiseworks / qtwebengine-chromium-os2

Port of Chromium and related tools to OS/2
9 stars 2 forks source link

Fix PlatformThread::SetCurrentThreadPriorityImpl #27

Closed dmik closed 3 years ago

dmik commented 3 years ago

On OS/2 we use the Posix code path for threads which means pthreads and LIBC setpriority/getpriority to manipulate thread priorities. However, setpriority is in fact intended to change the priority of the whole process in Posix. It changes individual thread priorities only on Linux due to a special exception of its implementation (see its man7). OS/2 LIBC, on the contrary, follows the Posix standard regarding the scope and sets the process priority instead (with DosSetPriority(PRTYS_PROCESS)). And although it doesn't seem to be exactly the same as on Posix (because on OS/2 only the default priority for new threads is changed, not the actual priority of already running threads), it matches even less what Linux (and Chromium) expects.

Given that LIBC doesn't expose any API to change thread priority, we will have to use DosSetPriority(PRTYS_THREAD) directly in Chromium.

This might be related to #22 and #26 (in part).