Raise a fatal error in case of pipe failures
This was reported by gcc.
Lars Kanis
5 years ago
84 | 84 | interrupt_event = CreateEvent(NULL, TRUE, FALSE, NULL); |
85 | 85 | addInput(interrupt_event,INPUT_READ,this,ID_CHORE_THREADS); |
86 | 86 | #else |
87 | pipe(interrupt_fds); | |
87 | if(pipe(interrupt_fds) == -1) rb_fatal("failed to allocate pipe for interrupt events"); | |
88 | 88 | fcntl(interrupt_fds[0], F_SETFL, O_NONBLOCK); |
89 | 89 | addInput(interrupt_fds[0],INPUT_READ,this,ID_CHORE_THREADS); |
90 | 90 | #endif |
129 | 129 | #else |
130 | 130 | char byte; |
131 | 131 | // clear the pipe |
132 | read(interrupt_fds[0], &byte, 1); | |
132 | if(read(interrupt_fds[0], &byte, 1) != 1) rb_fatal("failed to read from pipe for interrupt events"); | |
133 | 133 | #endif |
134 | 134 | #endif |
135 | 135 | return FXRbApp_onChoreThreads(this, obj, sel, p); |
171 | 171 | #ifdef WIN32 |
172 | 172 | SetEvent(FXRbApp::interrupt_event); |
173 | 173 | #else |
174 | write(FXRbApp::interrupt_fds[1], "X", 1); | |
174 | if(write(FXRbApp::interrupt_fds[1], "X", 1) != 1) rb_fatal("failed to write to pipe for interrupt events"); | |
175 | 175 | #endif |
176 | 176 | } |
177 | 177 | #endif |