mirror of https://github.com/encounter/SDL.git
wayland: Dramatically lower the timeout when reading/writing pipes
This commit is contained in:
parent
cf12496311
commit
c59d4dcd38
|
@ -36,6 +36,11 @@
|
|||
|
||||
#include "SDL_waylanddyn.h"
|
||||
|
||||
/* FIXME: This is arbitrary, but we want this to be less than a frame because
|
||||
* any longer can potentially spin an infinite loop of PumpEvents (!)
|
||||
*/
|
||||
#define PIPE_MS_TIMEOUT 10
|
||||
|
||||
static ssize_t
|
||||
write_pipe(int fd, const void* buffer, size_t total_length, size_t *pos)
|
||||
{
|
||||
|
@ -47,7 +52,7 @@ write_pipe(int fd, const void* buffer, size_t total_length, size_t *pos)
|
|||
sigset_t old_sig_set;
|
||||
struct timespec zerotime = {0};
|
||||
|
||||
ready = SDL_IOReady(fd, SDL_TRUE, 1 * 1000);
|
||||
ready = SDL_IOReady(fd, SDL_TRUE, PIPE_MS_TIMEOUT);
|
||||
|
||||
sigemptyset(&sig_set);
|
||||
sigaddset(&sig_set, SIGPIPE);
|
||||
|
@ -93,7 +98,7 @@ read_pipe(int fd, void** buffer, size_t* total_length, SDL_bool null_terminate)
|
|||
ssize_t bytes_read = 0;
|
||||
size_t pos = 0;
|
||||
|
||||
ready = SDL_IOReady(fd, SDL_FALSE, 1 * 1000);
|
||||
ready = SDL_IOReady(fd, SDL_FALSE, PIPE_MS_TIMEOUT);
|
||||
|
||||
if (ready == 0) {
|
||||
bytes_read = SDL_SetError("Pipe timeout");
|
||||
|
|
Loading…
Reference in New Issue