diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2020-01-18 22:09:44 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-05-07 14:57:15 +0200 |
commit | 92ac0d27737cf94e72208817cfd261a412a0e428 (patch) | |
tree | 7c86a6a7656f477a572209c9a3a3d246341c05e5 /nx-X11/programs/Xserver/os | |
parent | d282724c4abda9e59a029c2c485d7d046ff647db (diff) | |
download | nx-libs-92ac0d27737cf94e72208817cfd261a412a0e428.tar.gz nx-libs-92ac0d27737cf94e72208817cfd261a412a0e428.tar.bz2 nx-libs-92ac0d27737cf94e72208817cfd261a412a0e428.zip |
WaitFor.c Implement the intended NX_WAKEUP functionality
NX_WAKEUP had been non-effective and its effect had been tied to NX_TRANS_WAKEUP.
Diffstat (limited to 'nx-X11/programs/Xserver/os')
-rw-r--r-- | nx-X11/programs/Xserver/os/Imakefile | 2 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/os/WaitFor.c | 20 |
2 files changed, 12 insertions, 10 deletions
diff --git a/nx-X11/programs/Xserver/os/Imakefile b/nx-X11/programs/Xserver/os/Imakefile index da39c57ba..1b1c2d4fe 100644 --- a/nx-X11/programs/Xserver/os/Imakefile +++ b/nx-X11/programs/Xserver/os/Imakefile @@ -42,7 +42,7 @@ NX_DEFINES = -DNX_TRANS_SOCKET \ -DNX_TRANS_FOPEN \ -DNX_TRANS_SLEEP \ -DNX_TRANS_EXIT \ - -DNX_TRANS_WAKEUP=1000 \ + -DNX_TRANS_WAKEUP \ -DNXAGENT_SERVER \ $(NULL) diff --git a/nx-X11/programs/Xserver/os/WaitFor.c b/nx-X11/programs/Xserver/os/WaitFor.c index c76f8619c..9e887c726 100644 --- a/nx-X11/programs/Xserver/os/WaitFor.c +++ b/nx-X11/programs/Xserver/os/WaitFor.c @@ -237,13 +237,15 @@ WaitForSomething(int *pClientsReady) /* * If caller has marked the first element of pClientsReady[], - * bail out of select after a short (NX_TRANS_WAKEUP) - * timeout. We need this to let the NX agent remove the splash - * screen when the timeout is expired. A better option would - * be to use the existing screen-saver timeout but it can be - * modified by clients, so we would need a special - * handling. This hack is trivial and keeps WaitForSomething() - * backward compatible with the existing servers. + * bail out of select after the timeout given in the second + * element. We need this to let the NX agent remove the splash + * screen when the timeout is expired even if there's no + * client. Otherwise WaitForSomething would block. A better + * option would be to use the existing screen-saver timeout + * but it can be modified by clients, so we would need a + * special handling. This hack is trivial and keeps + * WaitForSomething() backward compatible with the existing + * servers. */ if (pClientsReady[0] == -1) @@ -257,7 +259,7 @@ WaitForSomething(int *pClientsReady) timeoutInMillis = GetTimeInMillis(); - if (timeoutInMillis - startTimeInMillis >= NX_TRANS_WAKEUP) + if (timeoutInMillis - startTimeInMillis >= pClientsReady[1]) { #ifdef NX_TRANS_DEBUG fprintf(stderr, "WaitForSomething: Returning 0 because of wakeup timeout.\n"); @@ -265,7 +267,7 @@ WaitForSomething(int *pClientsReady) return 0; } - timeoutInMillis = NX_TRANS_WAKEUP - (timeoutInMillis - startTimeInMillis); + timeoutInMillis = pClientsReady[1] - (timeoutInMillis - startTimeInMillis); #ifdef NX_TRANS_DEBUG fprintf(stderr, "WaitForSomething: Milliseconds to next wakeup are %ld.\n", |