21 #include "../../SDL_internal.h" 27 #if !SDL_THREADS_DISABLED 29 #include <sys/resource.h> 36 #define RTKIT_DBUS_NODE "org.freedesktop.RealtimeKit1" 37 #define RTKIT_DBUS_PATH "/org/freedesktop/RealtimeKit1" 38 #define RTKIT_DBUS_INTERFACE "org.freedesktop.RealtimeKit1" 40 static pthread_once_t rtkit_initialize_once = PTHREAD_ONCE_INIT;
41 static Sint32 rtkit_min_nice_level = -20;
46 SDL_DBusContext *dbus = SDL_DBus_GetContext();
49 if (!dbus || !SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE,
"MinNiceLevel",
50 DBUS_TYPE_INT32, &rtkit_min_nice_level)) {
51 rtkit_min_nice_level = -20;
56 rtkit_setpriority(pid_t thread,
int nice_level)
60 SDL_DBusContext *dbus = SDL_DBus_GetContext();
62 pthread_once(&rtkit_initialize_once, rtkit_initialize);
64 if (si32 < rtkit_min_nice_level)
65 si32 = rtkit_min_nice_level;
67 if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn,
68 RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE,
"MakeThreadHighPriority",
69 DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_INT32, &si32, DBUS_TYPE_INVALID,
83 #if SDL_THREADS_DISABLED 86 if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) {
102 if (rtkit_setpriority((pid_t)threadID, priority)) {
#define SDL_LinuxSetThreadPriority
#define SDL_Unsupported()