nio4r 2.3.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libev native API header
3
3
  *
4
- * Copyright (c) 2007,2008,2009,2010,2011,2012,2015 Marc Alexander Lehmann <libev@schmorp.de>
4
+ * Copyright (c) 2007-2018 Marc Alexander Lehmann <libev@schmorp.de>
5
5
  * All rights reserved.
6
6
  *
7
7
  * Redistribution and use in source and binary forms, with or without modifica-
@@ -43,19 +43,25 @@
43
43
  #ifdef __cplusplus
44
44
  # define EV_CPP(x) x
45
45
  # if __cplusplus >= 201103L
46
- # define EV_THROW noexcept
46
+ # define EV_NOEXCEPT noexcept
47
47
  # else
48
- # define EV_THROW throw ()
48
+ # define EV_NOEXCEPT
49
49
  # endif
50
50
  #else
51
51
  # define EV_CPP(x)
52
- # define EV_THROW
52
+ # define EV_NOEXCEPT
53
53
  #endif
54
+ #define EV_THROW EV_NOEXCEPT /* pre-4.25, do not use in new code */
54
55
 
55
56
  EV_CPP(extern "C" {)
56
57
 
57
58
  /*****************************************************************************/
58
59
 
60
+ /* pre-4.0 compatibility */
61
+ #ifndef EV_COMPAT3
62
+ # define EV_COMPAT3 1
63
+ #endif
64
+
59
65
  #ifndef EV_FEATURES
60
66
  # if defined __OPTIMIZE_SIZE__
61
67
  # define EV_FEATURES 0x7c
@@ -206,7 +212,7 @@ struct ev_loop;
206
212
  /*****************************************************************************/
207
213
 
208
214
  #define EV_VERSION_MAJOR 4
209
- #define EV_VERSION_MINOR 24
215
+ #define EV_VERSION_MINOR 25
210
216
 
211
217
  /* eventmask, revents, events... */
212
218
  enum {
@@ -334,7 +340,7 @@ typedef struct ev_periodic
334
340
 
335
341
  ev_tstamp offset; /* rw */
336
342
  ev_tstamp interval; /* rw */
337
- ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now) EV_THROW; /* rw */
343
+ ev_tstamp (*reschedule_cb)(struct ev_periodic *w, ev_tstamp now) EV_NOEXCEPT; /* rw */
338
344
  } ev_periodic;
339
345
 
340
346
  /* invoked when the given signal has been received */
@@ -521,15 +527,15 @@ enum {
521
527
  };
522
528
 
523
529
  #if EV_PROTOTYPES
524
- EV_API_DECL int ev_version_major (void) EV_THROW;
525
- EV_API_DECL int ev_version_minor (void) EV_THROW;
530
+ EV_API_DECL int ev_version_major (void) EV_NOEXCEPT;
531
+ EV_API_DECL int ev_version_minor (void) EV_NOEXCEPT;
526
532
 
527
- EV_API_DECL unsigned int ev_supported_backends (void) EV_THROW;
528
- EV_API_DECL unsigned int ev_recommended_backends (void) EV_THROW;
529
- EV_API_DECL unsigned int ev_embeddable_backends (void) EV_THROW;
533
+ EV_API_DECL unsigned int ev_supported_backends (void) EV_NOEXCEPT;
534
+ EV_API_DECL unsigned int ev_recommended_backends (void) EV_NOEXCEPT;
535
+ EV_API_DECL unsigned int ev_embeddable_backends (void) EV_NOEXCEPT;
530
536
 
531
- EV_API_DECL ev_tstamp ev_time (void) EV_THROW;
532
- EV_API_DECL void ev_sleep (ev_tstamp delay) EV_THROW; /* sleep for a while */
537
+ EV_API_DECL ev_tstamp ev_time (void) EV_NOEXCEPT;
538
+ EV_API_DECL void ev_sleep (ev_tstamp delay) EV_NOEXCEPT; /* sleep for a while */
533
539
 
534
540
  /* Sets the allocation function to use, works like realloc.
535
541
  * It is used to allocate and free memory.
@@ -537,26 +543,26 @@ EV_API_DECL void ev_sleep (ev_tstamp delay) EV_THROW; /* sleep for a while */
537
543
  * or take some potentially destructive action.
538
544
  * The default is your system realloc function.
539
545
  */
540
- EV_API_DECL void ev_set_allocator (void *(*cb)(void *ptr, long size) EV_THROW) EV_THROW;
546
+ EV_API_DECL void ev_set_allocator (void *(*cb)(void *ptr, long size) EV_NOEXCEPT) EV_NOEXCEPT;
541
547
 
542
548
  /* set the callback function to call on a
543
549
  * retryable syscall error
544
550
  * (such as failed select, poll, epoll_wait)
545
551
  */
546
- EV_API_DECL void ev_set_syserr_cb (void (*cb)(const char *msg) EV_THROW) EV_THROW;
552
+ EV_API_DECL void ev_set_syserr_cb (void (*cb)(const char *msg) EV_NOEXCEPT) EV_NOEXCEPT;
547
553
 
548
554
  #if EV_MULTIPLICITY
549
555
 
550
556
  /* the default loop is the only one that handles signals and child watchers */
551
557
  /* you can call this as often as you like */
552
- EV_API_DECL struct ev_loop *ev_default_loop (unsigned int flags EV_CPP (= 0)) EV_THROW;
558
+ EV_API_DECL struct ev_loop *ev_default_loop (unsigned int flags EV_CPP (= 0)) EV_NOEXCEPT;
553
559
 
554
560
  #ifdef EV_API_STATIC
555
561
  EV_API_DECL struct ev_loop *ev_default_loop_ptr;
556
562
  #endif
557
563
 
558
564
  EV_INLINE struct ev_loop *
559
- ev_default_loop_uc_ (void) EV_THROW
565
+ ev_default_loop_uc_ (void) EV_NOEXCEPT
560
566
  {
561
567
  extern struct ev_loop *ev_default_loop_ptr;
562
568
 
@@ -564,31 +570,31 @@ ev_default_loop_uc_ (void) EV_THROW
564
570
  }
565
571
 
566
572
  EV_INLINE int
567
- ev_is_default_loop (EV_P) EV_THROW
573
+ ev_is_default_loop (EV_P) EV_NOEXCEPT
568
574
  {
569
575
  return EV_A == EV_DEFAULT_UC;
570
576
  }
571
577
 
572
578
  /* create and destroy alternative loops that don't handle signals */
573
- EV_API_DECL struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0)) EV_THROW;
579
+ EV_API_DECL struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0)) EV_NOEXCEPT;
574
580
 
575
- EV_API_DECL ev_tstamp ev_now (EV_P) EV_THROW; /* time w.r.t. timers and the eventloop, updated after each poll */
581
+ EV_API_DECL ev_tstamp ev_now (EV_P) EV_NOEXCEPT; /* time w.r.t. timers and the eventloop, updated after each poll */
576
582
 
577
583
  #else
578
584
 
579
- EV_API_DECL int ev_default_loop (unsigned int flags EV_CPP (= 0)) EV_THROW; /* returns true when successful */
585
+ EV_API_DECL int ev_default_loop (unsigned int flags EV_CPP (= 0)) EV_NOEXCEPT; /* returns true when successful */
580
586
 
581
587
  EV_API_DECL ev_tstamp ev_rt_now;
582
588
 
583
589
  EV_INLINE ev_tstamp
584
- ev_now (void) EV_THROW
590
+ ev_now (void) EV_NOEXCEPT
585
591
  {
586
592
  return ev_rt_now;
587
593
  }
588
594
 
589
595
  /* looks weird, but ev_is_default_loop (EV_A) still works if this exists */
590
596
  EV_INLINE int
591
- ev_is_default_loop (void) EV_THROW
597
+ ev_is_default_loop (void) EV_NOEXCEPT
592
598
  {
593
599
  return 1;
594
600
  }
@@ -602,17 +608,17 @@ EV_API_DECL void ev_loop_destroy (EV_P);
602
608
  /* when you want to re-use it in the child */
603
609
  /* you can call it in either the parent or the child */
604
610
  /* you can actually call it at any time, anywhere :) */
605
- EV_API_DECL void ev_loop_fork (EV_P) EV_THROW;
611
+ EV_API_DECL void ev_loop_fork (EV_P) EV_NOEXCEPT;
606
612
 
607
- EV_API_DECL unsigned int ev_backend (EV_P) EV_THROW; /* backend in use by loop */
613
+ EV_API_DECL unsigned int ev_backend (EV_P) EV_NOEXCEPT; /* backend in use by loop */
608
614
 
609
- EV_API_DECL void ev_now_update (EV_P) EV_THROW; /* update event loop time */
615
+ EV_API_DECL void ev_now_update (EV_P) EV_NOEXCEPT; /* update event loop time */
610
616
 
611
617
  #if EV_WALK_ENABLE
612
618
  /* walk (almost) all watchers in the loop of a given type, invoking the */
613
619
  /* callback on every such watcher. The callback might stop the watcher, */
614
620
  /* but do nothing else with the loop */
615
- EV_API_DECL void ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_THROW;
621
+ EV_API_DECL void ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_NOEXCEPT;
616
622
  #endif
617
623
 
618
624
  #endif /* prototypes */
@@ -632,46 +638,46 @@ enum {
632
638
 
633
639
  #if EV_PROTOTYPES
634
640
  EV_API_DECL int ev_run (EV_P_ int flags EV_CPP (= 0));
635
- EV_API_DECL void ev_break (EV_P_ int how EV_CPP (= EVBREAK_ONE)) EV_THROW; /* break out of the loop */
641
+ EV_API_DECL void ev_break (EV_P_ int how EV_CPP (= EVBREAK_ONE)) EV_NOEXCEPT; /* break out of the loop */
636
642
 
637
643
  /*
638
644
  * ref/unref can be used to add or remove a refcount on the mainloop. every watcher
639
645
  * keeps one reference. if you have a long-running watcher you never unregister that
640
646
  * should not keep ev_loop from running, unref() after starting, and ref() before stopping.
641
647
  */
642
- EV_API_DECL void ev_ref (EV_P) EV_THROW;
643
- EV_API_DECL void ev_unref (EV_P) EV_THROW;
648
+ EV_API_DECL void ev_ref (EV_P) EV_NOEXCEPT;
649
+ EV_API_DECL void ev_unref (EV_P) EV_NOEXCEPT;
644
650
 
645
651
  /*
646
652
  * convenience function, wait for a single event, without registering an event watcher
647
653
  * if timeout is < 0, do wait indefinitely
648
654
  */
649
- EV_API_DECL void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_THROW;
655
+ EV_API_DECL void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) EV_NOEXCEPT;
650
656
 
651
657
  # if EV_FEATURE_API
652
- EV_API_DECL unsigned int ev_iteration (EV_P) EV_THROW; /* number of loop iterations */
653
- EV_API_DECL unsigned int ev_depth (EV_P) EV_THROW; /* #ev_loop enters - #ev_loop leaves */
654
- EV_API_DECL void ev_verify (EV_P) EV_THROW; /* abort if loop data corrupted */
658
+ EV_API_DECL unsigned int ev_iteration (EV_P) EV_NOEXCEPT; /* number of loop iterations */
659
+ EV_API_DECL unsigned int ev_depth (EV_P) EV_NOEXCEPT; /* #ev_loop enters - #ev_loop leaves */
660
+ EV_API_DECL void ev_verify (EV_P) EV_NOEXCEPT; /* abort if loop data corrupted */
655
661
 
656
- EV_API_DECL void ev_set_io_collect_interval (EV_P_ ev_tstamp interval) EV_THROW; /* sleep at least this time, default 0 */
657
- EV_API_DECL void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_THROW; /* sleep at least this time, default 0 */
662
+ EV_API_DECL void ev_set_io_collect_interval (EV_P_ ev_tstamp interval) EV_NOEXCEPT; /* sleep at least this time, default 0 */
663
+ EV_API_DECL void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval) EV_NOEXCEPT; /* sleep at least this time, default 0 */
658
664
 
659
665
  /* advanced stuff for threading etc. support, see docs */
660
- EV_API_DECL void ev_set_userdata (EV_P_ void *data) EV_THROW;
661
- EV_API_DECL void *ev_userdata (EV_P) EV_THROW;
666
+ EV_API_DECL void ev_set_userdata (EV_P_ void *data) EV_NOEXCEPT;
667
+ EV_API_DECL void *ev_userdata (EV_P) EV_NOEXCEPT;
662
668
  typedef void (*ev_loop_callback)(EV_P);
663
- EV_API_DECL void ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_THROW;
669
+ EV_API_DECL void ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_NOEXCEPT;
664
670
  /* C++ doesn't allow the use of the ev_loop_callback typedef here, so we need to spell it out */
665
- EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_THROW, void (*acquire)(EV_P) EV_THROW) EV_THROW;
671
+ EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_NOEXCEPT, void (*acquire)(EV_P) EV_NOEXCEPT) EV_NOEXCEPT;
666
672
 
667
- EV_API_DECL unsigned int ev_pending_count (EV_P) EV_THROW; /* number of pending events, if any */
673
+ EV_API_DECL unsigned int ev_pending_count (EV_P) EV_NOEXCEPT; /* number of pending events, if any */
668
674
  EV_API_DECL void ev_invoke_pending (EV_P); /* invoke all pending watchers */
669
675
 
670
676
  /*
671
677
  * stop/start the timer handling.
672
678
  */
673
- EV_API_DECL void ev_suspend (EV_P) EV_THROW;
674
- EV_API_DECL void ev_resume (EV_P) EV_THROW;
679
+ EV_API_DECL void ev_suspend (EV_P) EV_NOEXCEPT;
680
+ EV_API_DECL void ev_resume (EV_P) EV_NOEXCEPT;
675
681
  #endif
676
682
 
677
683
  #endif
@@ -739,85 +745,85 @@ EV_API_DECL void ev_resume (EV_P) EV_THROW;
739
745
 
740
746
  /* feeds an event into a watcher as if the event actually occurred */
741
747
  /* accepts any ev_watcher type */
742
- EV_API_DECL void ev_feed_event (EV_P_ void *w, int revents) EV_THROW;
743
- EV_API_DECL void ev_feed_fd_event (EV_P_ int fd, int revents) EV_THROW;
748
+ EV_API_DECL void ev_feed_event (EV_P_ void *w, int revents) EV_NOEXCEPT;
749
+ EV_API_DECL void ev_feed_fd_event (EV_P_ int fd, int revents) EV_NOEXCEPT;
744
750
  #if EV_SIGNAL_ENABLE
745
- EV_API_DECL void ev_feed_signal (int signum) EV_THROW;
746
- EV_API_DECL void ev_feed_signal_event (EV_P_ int signum) EV_THROW;
751
+ EV_API_DECL void ev_feed_signal (int signum) EV_NOEXCEPT;
752
+ EV_API_DECL void ev_feed_signal_event (EV_P_ int signum) EV_NOEXCEPT;
747
753
  #endif
748
754
  EV_API_DECL void ev_invoke (EV_P_ void *w, int revents);
749
- EV_API_DECL int ev_clear_pending (EV_P_ void *w) EV_THROW;
755
+ EV_API_DECL int ev_clear_pending (EV_P_ void *w) EV_NOEXCEPT;
750
756
 
751
- EV_API_DECL void ev_io_start (EV_P_ ev_io *w) EV_THROW;
752
- EV_API_DECL void ev_io_stop (EV_P_ ev_io *w) EV_THROW;
757
+ EV_API_DECL void ev_io_start (EV_P_ ev_io *w) EV_NOEXCEPT;
758
+ EV_API_DECL void ev_io_stop (EV_P_ ev_io *w) EV_NOEXCEPT;
753
759
 
754
- EV_API_DECL void ev_timer_start (EV_P_ ev_timer *w) EV_THROW;
755
- EV_API_DECL void ev_timer_stop (EV_P_ ev_timer *w) EV_THROW;
760
+ EV_API_DECL void ev_timer_start (EV_P_ ev_timer *w) EV_NOEXCEPT;
761
+ EV_API_DECL void ev_timer_stop (EV_P_ ev_timer *w) EV_NOEXCEPT;
756
762
  /* stops if active and no repeat, restarts if active and repeating, starts if inactive and repeating */
757
- EV_API_DECL void ev_timer_again (EV_P_ ev_timer *w) EV_THROW;
763
+ EV_API_DECL void ev_timer_again (EV_P_ ev_timer *w) EV_NOEXCEPT;
758
764
  /* return remaining time */
759
- EV_API_DECL ev_tstamp ev_timer_remaining (EV_P_ ev_timer *w) EV_THROW;
765
+ EV_API_DECL ev_tstamp ev_timer_remaining (EV_P_ ev_timer *w) EV_NOEXCEPT;
760
766
 
761
767
  #if EV_PERIODIC_ENABLE
762
- EV_API_DECL void ev_periodic_start (EV_P_ ev_periodic *w) EV_THROW;
763
- EV_API_DECL void ev_periodic_stop (EV_P_ ev_periodic *w) EV_THROW;
764
- EV_API_DECL void ev_periodic_again (EV_P_ ev_periodic *w) EV_THROW;
768
+ EV_API_DECL void ev_periodic_start (EV_P_ ev_periodic *w) EV_NOEXCEPT;
769
+ EV_API_DECL void ev_periodic_stop (EV_P_ ev_periodic *w) EV_NOEXCEPT;
770
+ EV_API_DECL void ev_periodic_again (EV_P_ ev_periodic *w) EV_NOEXCEPT;
765
771
  #endif
766
772
 
767
773
  /* only supported in the default loop */
768
774
  #if EV_SIGNAL_ENABLE
769
- EV_API_DECL void ev_signal_start (EV_P_ ev_signal *w) EV_THROW;
770
- EV_API_DECL void ev_signal_stop (EV_P_ ev_signal *w) EV_THROW;
775
+ EV_API_DECL void ev_signal_start (EV_P_ ev_signal *w) EV_NOEXCEPT;
776
+ EV_API_DECL void ev_signal_stop (EV_P_ ev_signal *w) EV_NOEXCEPT;
771
777
  #endif
772
778
 
773
779
  /* only supported in the default loop */
774
780
  # if EV_CHILD_ENABLE
775
- EV_API_DECL void ev_child_start (EV_P_ ev_child *w) EV_THROW;
776
- EV_API_DECL void ev_child_stop (EV_P_ ev_child *w) EV_THROW;
781
+ EV_API_DECL void ev_child_start (EV_P_ ev_child *w) EV_NOEXCEPT;
782
+ EV_API_DECL void ev_child_stop (EV_P_ ev_child *w) EV_NOEXCEPT;
777
783
  # endif
778
784
 
779
785
  # if EV_STAT_ENABLE
780
- EV_API_DECL void ev_stat_start (EV_P_ ev_stat *w) EV_THROW;
781
- EV_API_DECL void ev_stat_stop (EV_P_ ev_stat *w) EV_THROW;
782
- EV_API_DECL void ev_stat_stat (EV_P_ ev_stat *w) EV_THROW;
786
+ EV_API_DECL void ev_stat_start (EV_P_ ev_stat *w) EV_NOEXCEPT;
787
+ EV_API_DECL void ev_stat_stop (EV_P_ ev_stat *w) EV_NOEXCEPT;
788
+ EV_API_DECL void ev_stat_stat (EV_P_ ev_stat *w) EV_NOEXCEPT;
783
789
  # endif
784
790
 
785
791
  # if EV_IDLE_ENABLE
786
- EV_API_DECL void ev_idle_start (EV_P_ ev_idle *w) EV_THROW;
787
- EV_API_DECL void ev_idle_stop (EV_P_ ev_idle *w) EV_THROW;
792
+ EV_API_DECL void ev_idle_start (EV_P_ ev_idle *w) EV_NOEXCEPT;
793
+ EV_API_DECL void ev_idle_stop (EV_P_ ev_idle *w) EV_NOEXCEPT;
788
794
  # endif
789
795
 
790
796
  #if EV_PREPARE_ENABLE
791
- EV_API_DECL void ev_prepare_start (EV_P_ ev_prepare *w) EV_THROW;
792
- EV_API_DECL void ev_prepare_stop (EV_P_ ev_prepare *w) EV_THROW;
797
+ EV_API_DECL void ev_prepare_start (EV_P_ ev_prepare *w) EV_NOEXCEPT;
798
+ EV_API_DECL void ev_prepare_stop (EV_P_ ev_prepare *w) EV_NOEXCEPT;
793
799
  #endif
794
800
 
795
801
  #if EV_CHECK_ENABLE
796
- EV_API_DECL void ev_check_start (EV_P_ ev_check *w) EV_THROW;
797
- EV_API_DECL void ev_check_stop (EV_P_ ev_check *w) EV_THROW;
802
+ EV_API_DECL void ev_check_start (EV_P_ ev_check *w) EV_NOEXCEPT;
803
+ EV_API_DECL void ev_check_stop (EV_P_ ev_check *w) EV_NOEXCEPT;
798
804
  #endif
799
805
 
800
806
  # if EV_FORK_ENABLE
801
- EV_API_DECL void ev_fork_start (EV_P_ ev_fork *w) EV_THROW;
802
- EV_API_DECL void ev_fork_stop (EV_P_ ev_fork *w) EV_THROW;
807
+ EV_API_DECL void ev_fork_start (EV_P_ ev_fork *w) EV_NOEXCEPT;
808
+ EV_API_DECL void ev_fork_stop (EV_P_ ev_fork *w) EV_NOEXCEPT;
803
809
  # endif
804
810
 
805
811
  # if EV_CLEANUP_ENABLE
806
- EV_API_DECL void ev_cleanup_start (EV_P_ ev_cleanup *w) EV_THROW;
807
- EV_API_DECL void ev_cleanup_stop (EV_P_ ev_cleanup *w) EV_THROW;
812
+ EV_API_DECL void ev_cleanup_start (EV_P_ ev_cleanup *w) EV_NOEXCEPT;
813
+ EV_API_DECL void ev_cleanup_stop (EV_P_ ev_cleanup *w) EV_NOEXCEPT;
808
814
  # endif
809
815
 
810
816
  # if EV_EMBED_ENABLE
811
817
  /* only supported when loop to be embedded is in fact embeddable */
812
- EV_API_DECL void ev_embed_start (EV_P_ ev_embed *w) EV_THROW;
813
- EV_API_DECL void ev_embed_stop (EV_P_ ev_embed *w) EV_THROW;
814
- EV_API_DECL void ev_embed_sweep (EV_P_ ev_embed *w) EV_THROW;
818
+ EV_API_DECL void ev_embed_start (EV_P_ ev_embed *w) EV_NOEXCEPT;
819
+ EV_API_DECL void ev_embed_stop (EV_P_ ev_embed *w) EV_NOEXCEPT;
820
+ EV_API_DECL void ev_embed_sweep (EV_P_ ev_embed *w) EV_NOEXCEPT;
815
821
  # endif
816
822
 
817
823
  # if EV_ASYNC_ENABLE
818
- EV_API_DECL void ev_async_start (EV_P_ ev_async *w) EV_THROW;
819
- EV_API_DECL void ev_async_stop (EV_P_ ev_async *w) EV_THROW;
820
- EV_API_DECL void ev_async_send (EV_P_ ev_async *w) EV_THROW;
824
+ EV_API_DECL void ev_async_start (EV_P_ ev_async *w) EV_NOEXCEPT;
825
+ EV_API_DECL void ev_async_stop (EV_P_ ev_async *w) EV_NOEXCEPT;
826
+ EV_API_DECL void ev_async_send (EV_P_ ev_async *w) EV_NOEXCEPT;
821
827
  # endif
822
828
 
823
829
  #if EV_COMPAT3
@@ -239,7 +239,7 @@ inline_size
239
239
  int
240
240
  epoll_init (EV_P_ int flags)
241
241
  {
242
- #ifdef EPOLL_CLOEXEC
242
+ #if defined EPOLL_CLOEXEC && !defined __ANDROID__
243
243
  backend_fd = epoll_create1 (EPOLL_CLOEXEC);
244
244
 
245
245
  if (backend_fd < 0 && (errno == EINVAL || errno == ENOSYS))
@@ -195,8 +195,8 @@ VARx(unsigned int, loop_depth) /* #ev_run enters - #ev_run leaves */
195
195
 
196
196
  VARx(void *, userdata)
197
197
  /* C++ doesn't support the ev_loop_callback typedef here. stinks. */
198
- VAR (release_cb, void (*release_cb)(EV_P) EV_THROW)
199
- VAR (acquire_cb, void (*acquire_cb)(EV_P) EV_THROW)
198
+ VAR (release_cb, void (*release_cb)(EV_P) EV_NOEXCEPT)
199
+ VAR (acquire_cb, void (*acquire_cb)(EV_P) EV_NOEXCEPT)
200
200
  VAR (invoke_cb , ev_loop_callback invoke_cb)
201
201
  #endif
202
202
 
@@ -12,7 +12,7 @@
12
12
 
13
13
  struct NIO_Selector
14
14
  {
15
- ev_loop *ev_loop;
15
+ struct ev_loop *ev_loop;
16
16
  struct ev_timer timer; /* for timeouts */
17
17
  struct ev_io wakeup;
18
18
 
@@ -52,8 +52,8 @@ static VALUE NIO_Selector_close_synchronized(VALUE *args);
52
52
  static VALUE NIO_Selector_closed_synchronized(VALUE *args);
53
53
 
54
54
  static int NIO_Selector_run(struct NIO_Selector *selector, VALUE timeout);
55
- static void NIO_Selector_timeout_callback(ev_loop *ev_loop, struct ev_timer *timer, int revents);
56
- static void NIO_Selector_wakeup_callback(ev_loop *ev_loop, struct ev_io *io, int revents);
55
+ static void NIO_Selector_timeout_callback(struct ev_loop *ev_loop, struct ev_timer *timer, int revents);
56
+ static void NIO_Selector_wakeup_callback(struct ev_loop *ev_loop, struct ev_io *io, int revents);
57
57
 
58
58
  /* Default number of slots in the buffer for selected monitors */
59
59
  #define INITIAL_READY_BUFFER 32
@@ -530,12 +530,12 @@ static VALUE NIO_Selector_is_empty(VALUE self)
530
530
 
531
531
 
532
532
  /* Called whenever a timeout fires on the event loop */
533
- static void NIO_Selector_timeout_callback(ev_loop *ev_loop, struct ev_timer *timer, int revents)
533
+ static void NIO_Selector_timeout_callback(struct ev_loop *ev_loop, struct ev_timer *timer, int revents)
534
534
  {
535
535
  }
536
536
 
537
537
  /* Called whenever a wakeup request is sent to a selector */
538
- static void NIO_Selector_wakeup_callback(ev_loop *ev_loop, struct ev_io *io, int revents)
538
+ static void NIO_Selector_wakeup_callback(struct ev_loop *ev_loop, struct ev_io *io, int revents)
539
539
  {
540
540
  char buffer[128];
541
541
  struct NIO_Selector *selector = (struct NIO_Selector *)io->data;
@@ -546,7 +546,7 @@ static void NIO_Selector_wakeup_callback(ev_loop *ev_loop, struct ev_io *io, int
546
546
  }
547
547
 
548
548
  /* libev callback fired whenever a monitor gets an event */
549
- void NIO_Selector_monitor_callback(ev_loop *ev_loop, struct ev_io *io, int revents)
549
+ void NIO_Selector_monitor_callback(struct ev_loop *ev_loop, struct ev_io *io, int revents)
550
550
  {
551
551
  struct NIO_Monitor *monitor_data = (struct NIO_Monitor *)io->data;
552
552
  struct NIO_Selector *selector = monitor_data->selector;
data/lib/nio.rb CHANGED
@@ -18,7 +18,7 @@ if ENV["NIO4R_PURE"] == "true" || (Gem.win_platform? && !defined?(JRUBY_VERSION)
18
18
  require "nio/monitor"
19
19
  require "nio/selector"
20
20
  require "nio/bytebuffer"
21
- NIO::ENGINE = "ruby".freeze
21
+ NIO::ENGINE = "ruby"
22
22
  else
23
23
  require "nio4r_ext"
24
24
 
@@ -26,8 +26,8 @@ else
26
26
  require "java"
27
27
  require "jruby"
28
28
  org.nio4r.Nio4r.new.load(JRuby.runtime, false)
29
- NIO::ENGINE = "java".freeze
29
+ NIO::ENGINE = "java"
30
30
  else
31
- NIO::ENGINE = "libev".freeze
31
+ NIO::ENGINE = "libev"
32
32
  end
33
33
  end
@@ -6,16 +6,18 @@ module NIO
6
6
  attr_reader :io, :interests, :selector
7
7
  attr_accessor :value, :readiness
8
8
 
9
- # :nodoc
9
+ # :nodoc:
10
10
  def initialize(io, interests, selector)
11
- unless io.is_a?(IO)
12
- if IO.respond_to? :try_convert
13
- io = IO.try_convert(io)
14
- elsif io.respond_to? :to_io
15
- io = io.to_io
16
- end
11
+ unless io.is_a? OpenSSL::SSL::SSLSocket
12
+ unless io.is_a?(IO)
13
+ if IO.respond_to? :try_convert
14
+ io = IO.try_convert(io)
15
+ elsif io.respond_to? :to_io
16
+ io = io.to_io
17
+ end
17
18
 
18
- raise TypeError, "can't convert #{io.class} into IO" unless io.is_a? IO
19
+ raise TypeError, "can't convert #{io.class} into IO" unless io.is_a? IO
20
+ end
19
21
  end
20
22
 
21
23
  @io = io