mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 07:18:39 +09:00
parent
470a6e4401
commit
13fcc4a046
949 changed files with 95662 additions and 444 deletions
|
|
@ -21,6 +21,8 @@
|
|||
#include <windows.h>
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
using mozilla::IsVistaOrLater;
|
||||
#elif defined(XP_MACOSX)
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#include <pratom.h>
|
||||
|
|
@ -443,6 +445,12 @@ nsAutoLowPriorityIO::nsAutoLowPriorityIO()
|
|||
lowIOPrioritySet = IsVistaOrLater() &&
|
||||
SetThreadPriority(GetCurrentThread(),
|
||||
THREAD_MODE_BACKGROUND_BEGIN);
|
||||
#elif defined(XP_MACOSX)
|
||||
oldPriority = getiopolicy_np(IOPOL_TYPE_DISK, IOPOL_SCOPE_THREAD);
|
||||
lowIOPrioritySet = oldPriority != -1 &&
|
||||
setiopolicy_np(IOPOL_TYPE_DISK,
|
||||
IOPOL_SCOPE_THREAD,
|
||||
IOPOL_THROTTLE) != -1;
|
||||
#else
|
||||
lowIOPrioritySet = false;
|
||||
#endif
|
||||
|
|
@ -455,5 +463,9 @@ nsAutoLowPriorityIO::~nsAutoLowPriorityIO()
|
|||
// On Windows the old thread priority is automatically restored
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_END);
|
||||
}
|
||||
#elif defined(XP_MACOSX)
|
||||
if (MOZ_LIKELY(lowIOPrioritySet)) {
|
||||
setiopolicy_np(IOPOL_TYPE_DISK, IOPOL_SCOPE_THREAD, oldPriority);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue