Skip to content

Commit

Permalink
Fix MakeThreadRealtime DBus method call on Linux, type mismatch due t…
Browse files Browse the repository at this point in the history
…o copy paste.

Nov 02 20:34:15 redcore rtkit-daemon[2825]: Failed to parse MakeThreadRealtime() method call: Argument 1 is specified to be of type "uint32", but is actually of type "int32"
Nov 02 20:34:15 redcore rtkit-daemon[2825]: Failed to parse MakeThreadRealtime() method call: Argument 1 is specified to be of type "uint32", but is actually of type "int32"

Docs:

http://git.0pointer.net/rtkit.git/tree/README

CLIENTS:
        To be able to make use of realtime scheduling clients may
        request so with a small D-Bus interface that is accessible on
        the interface org.freedesktop.RealtimeKit1 as object
        /org/freedesktop/RealtimeKit1 on the service
        org.freedesktop.RealtimeKit1:

                void MakeThreadRealtime(u64 thread_id, u32 priority);

                void MakeThreadHighPriority(u64 thread_id, s32 priority);
  • Loading branch information
slouken committed Nov 9, 2020
1 parent 5d34e3c commit abf9dfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Empty file modified Xcode/SDL/SDL.xcodeproj/project.pbxproj 100644 → 100755
Empty file.
8 changes: 4 additions & 4 deletions src/core/linux/SDL_threadprio.c
Expand Up @@ -162,13 +162,13 @@ static SDL_bool
rtkit_setpriority_realtime(pid_t thread, int rt_priority)
{
Uint64 ui64 = (Uint64)thread;
Sint32 si32 = (Sint32)rt_priority;
Uint32 ui32 = (Uint32)rt_priority;
SDL_DBusContext *dbus = SDL_DBus_GetContext();

pthread_once(&rtkit_initialize_once, rtkit_initialize);

if (si32 > rtkit_max_realtime_priority)
si32 = rtkit_max_realtime_priority;
if (ui32 > rtkit_max_realtime_priority)
ui32 = rtkit_max_realtime_priority;

// We always perform the thread state changes necessary for rtkit.
// This wastes some system calls if the state is already set but
Expand All @@ -180,7 +180,7 @@ rtkit_setpriority_realtime(pid_t thread, int rt_priority)

if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn,
RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MakeThreadRealtime",
DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_INT32, &si32, DBUS_TYPE_INVALID,
DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_UINT32, &ui32, DBUS_TYPE_INVALID,
DBUS_TYPE_INVALID)) {
return SDL_FALSE;
}
Expand Down

0 comments on commit abf9dfd

Please sign in to comment.