@@ -313,15 +313,46 @@ namespace rubinius {
313
313
RubyException::raise (exc);
314
314
}
315
315
316
- void Exception::errno_eagain_error (STATE, const char * reason ) {
316
+ void Exception::errno_wait_readable (STATE, int error ) {
317
317
Exception* exc;
318
- Class* exc_class = as<Class>( G (io)-> get_const (state, " EAGAINWaitReadable " )) ;
318
+ Class* exc_class;
319
319
320
- String* message = nil<String>();
320
+ if (error == EAGAIN) {
321
+ exc_class = as<Class>(G (io)->get_const (state, " EAGAINWaitReadable" ));
322
+ }
323
+ #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
324
+ else if (error == EWOULDBLOCK) {
325
+ exc_class = as<Class>(G (io)->get_const (state, " EWOULDBLOCKWaitReadable" ));
326
+ }
327
+ #endif
328
+ else {
329
+ exc_class = get_errno_error (state, Fixnum::from (error));
330
+ }
321
331
322
- if (reason) {
323
- message = String::create (state, reason);
332
+ String* message = String::create (state, " read would block" );
333
+
334
+ exc = make_errno_exception (state, exc_class, message, cNil);
335
+
336
+ RubyException::raise (exc);
337
+ }
338
+
339
+ void Exception::errno_wait_writable (STATE, int error) {
340
+ Exception* exc;
341
+ Class* exc_class;
342
+
343
+ if (error == EAGAIN) {
344
+ exc_class = as<Class>(G (io)->get_const (state, " EAGAINWaitWritable" ));
324
345
}
346
+ #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
347
+ else if (error == EWOULDBLOCK) {
348
+ exc_class = as<Class>(G (io)->get_const (state, " EWOULDBLOCKWaitWritable" ));
349
+ }
350
+ #endif
351
+ else {
352
+ exc_class = get_errno_error (state, Fixnum::from (error));
353
+ }
354
+
355
+ String* message = String::create (state, " write would block" );
325
356
326
357
exc = make_errno_exception (state, exc_class, message, cNil);
327
358
0 commit comments