[gnome-remote-desktop] rdp: Sort main loop events by probability of least signalled first



commit a0d4cd2f63430b111f8b038a5bec3700fdcd5340
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Tue Aug 16 16:19:05 2022 +0200

    rdp: Sort main loop events by probability of least signalled first
    
    For performance reasons, the events to wait for are supposed to be
    sorted in a way, that the least likely signalled events are sorted
    before the events, that are signalled a lot.
    When WaitForMultipleObjects() returns and an event was signalled, it
    returns the index of the signalled event with the lowest index.
    Currently, the returned index is unused, since the cause of spurious
    event signals with WinPR events is not known yet.
    However, regardless of this, do the first preparation step and already
    sort the WinPR events to wait for accordingly.

 src/grd-session-rdp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index 5139cb6d..6b2cb5d3 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -2124,6 +2124,8 @@ socket_thread_func (gpointer data)
           events[n_events++] = bw_measure_stop_event;
         }
 
+      events[n_events++] = channel_event;
+
       n_freerdp_handles = peer->GetEventHandles (peer, &events[n_events],
                                                  32 - n_events);
       if (!n_freerdp_handles)
@@ -2134,8 +2136,6 @@ socket_thread_func (gpointer data)
         }
       n_events += n_freerdp_handles;
 
-      events[n_events++] = channel_event;
-
       WaitForMultipleObjects (n_events, events, FALSE, INFINITE);
 
       if (session_rdp->session_should_stop)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]