Codebase list ruby-fxruby / 4f6b009
Raise a fatal error in case of pipe failures This was reported by gcc. Lars Kanis 5 years ago
1 changed file(s) with 3 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
8484 interrupt_event = CreateEvent(NULL, TRUE, FALSE, NULL);
8585 addInput(interrupt_event,INPUT_READ,this,ID_CHORE_THREADS);
8686 #else
87 pipe(interrupt_fds);
87 if(pipe(interrupt_fds) == -1) rb_fatal("failed to allocate pipe for interrupt events");
8888 fcntl(interrupt_fds[0], F_SETFL, O_NONBLOCK);
8989 addInput(interrupt_fds[0],INPUT_READ,this,ID_CHORE_THREADS);
9090 #endif
129129 #else
130130 char byte;
131131 // 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");
133133 #endif
134134 #endif
135135 return FXRbApp_onChoreThreads(this, obj, sel, p);
171171 #ifdef WIN32
172172 SetEvent(FXRbApp::interrupt_event);
173173 #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");
175175 #endif
176176 }
177177 #endif