cool.io 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69788383b1d7d04b499aed3a4c7430bde6af09cb
4
- data.tar.gz: a5bd943271281ef7e72c886cf07b33ea98a7ca0a
3
+ metadata.gz: b6201442e66732c1d2589755e844b10df6414c09
4
+ data.tar.gz: bcf6e2730e8045afac534230a9498214d31d6699
5
5
  SHA512:
6
- metadata.gz: 02ff98d0fa4b9b90ed484e5db28c88adcbf4dde3e27ee436282b5a2aab3ea0afe2cfe88d79b10cb643c717e1af0e93736b914112b42061ac640f4ae07a001e84
7
- data.tar.gz: ec26d9e2759c5b999f82dbf8dcfac2f407aa571bf941df4b0a6761c00787b793d0574429b0be6887316cbe861c7eef661300c50d7a662f69f87618f7be2717e9
6
+ metadata.gz: e6cc414776c937dc1cd8c8ecc834ea13367417e897882879238002594ffc57a22c1893910e0a2c5fb3e0d98d587a35535d4b5682755d925cfe3ad6c3cc3e5358
7
+ data.tar.gz: 5e1a01527ef12fdedf1335d3b0915d1496f1cd4511cd5e0d3e3c07e6e496a85aa66425ddde890d200fe4e03e63ae7d69f54886c65c68ac84ab65d7d96600272f
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ 1.4.0
2
+ -----
3
+
4
+ * Update libev to 4.20
5
+ * Sleep in timeout instead of select on Windows
6
+
1
7
  1.3.1
2
8
  -----
3
9
 
data/README.md CHANGED
@@ -92,6 +92,7 @@ Example Program
92
92
  Cool.io provides a Sinatra-like DSL for authoring event-driven programs:
93
93
 
94
94
  require 'cool.io'
95
+ require 'cool.io/dsl'
95
96
 
96
97
  ADDR = '127.0.0.1'
97
98
  PORT = 4321
@@ -15,6 +15,12 @@ TODO: document portability requirements for atomic pointer access
15
15
  TODO: possible cb aliasing?
16
16
  TODO: document requirements for function pointers and calling conventions.
17
17
 
18
+ 4.20 Sat Jun 20 13:01:43 CEST 2015
19
+ - prefer noexcept over throw () with C++ 11.
20
+ - update ecb.h due to incompatibilities with c11.
21
+ - fix a potential aliasing issue when reading and writing
22
+ watcher callbacks.
23
+
18
24
  4.19 Thu Sep 25 08:18:25 CEST 2014
19
25
  - ev.h wasn't valid C++ anymore, which tripped compilers other than
20
26
  clang, msvc or gcc (analyzed by Raphael 'kena' Poss). Unfortunately,
@@ -499,4 +505,3 @@ TODO: document requirements for function pointers and calling conventions.
499
505
 
500
506
  0.1 Wed Oct 31 21:31:48 CET 2007
501
507
  - original version; hacked together in <24h.
502
-
@@ -111,7 +111,7 @@
111
111
  # undef EV_USE_POLL
112
112
  # define EV_USE_POLL 0
113
113
  # endif
114
-
114
+
115
115
  # if HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H
116
116
  # ifndef EV_USE_EPOLL
117
117
  # define EV_USE_EPOLL EV_FEATURE_BACKENDS
@@ -120,7 +120,7 @@
120
120
  # undef EV_USE_EPOLL
121
121
  # define EV_USE_EPOLL 0
122
122
  # endif
123
-
123
+
124
124
  # if HAVE_KQUEUE && HAVE_SYS_EVENT_H
125
125
  # ifndef EV_USE_KQUEUE
126
126
  # define EV_USE_KQUEUE EV_FEATURE_BACKENDS
@@ -129,7 +129,7 @@
129
129
  # undef EV_USE_KQUEUE
130
130
  # define EV_USE_KQUEUE 0
131
131
  # endif
132
-
132
+
133
133
  # if HAVE_PORT_H && HAVE_PORT_CREATE
134
134
  # ifndef EV_USE_PORT
135
135
  # define EV_USE_PORT EV_FEATURE_BACKENDS
@@ -165,7 +165,7 @@
165
165
  # undef EV_USE_EVENTFD
166
166
  # define EV_USE_EVENTFD 0
167
167
  # endif
168
-
168
+
169
169
  #endif
170
170
 
171
171
  #include <stdlib.h>
@@ -497,7 +497,7 @@ struct signalfd_siginfo
497
497
  /*
498
498
  * libecb - http://software.schmorp.de/pkg/libecb
499
499
  *
500
- * Copyright (©) 2009-2014 Marc Alexander Lehmann <libecb@schmorp.de>
500
+ * Copyright (©) 2009-2015 Marc Alexander Lehmann <libecb@schmorp.de>
501
501
  * Copyright (©) 2011 Emanuele Giaquinta
502
502
  * All rights reserved.
503
503
  *
@@ -538,7 +538,7 @@ struct signalfd_siginfo
538
538
  #define ECB_H
539
539
 
540
540
  /* 16 bits major, 16 bits minor */
541
- #define ECB_VERSION 0x00010003
541
+ #define ECB_VERSION 0x00010004
542
542
 
543
543
  #ifdef _WIN32
544
544
  typedef signed char int8_t;
@@ -572,8 +572,11 @@ struct signalfd_siginfo
572
572
  #endif
573
573
  #endif
574
574
 
575
+ #define ECB_GCC_AMD64 (__amd64 || __amd64__ || __x86_64 || __x86_64__)
576
+ #define ECB_MSVC_AMD64 (_M_AMD64 || _M_X64)
577
+
575
578
  /* work around x32 idiocy by defining proper macros */
576
- #if __amd64 || __x86_64 || _M_AMD64 || _M_X64
579
+ #if ECB_GCC_AMD64 || ECB_MSVC_AMD64
577
580
  #if _ILP32
578
581
  #define ECB_AMD64_X32 1
579
582
  #else
@@ -588,12 +591,24 @@ struct signalfd_siginfo
588
591
  * we try to detect these and simply assume they are not gcc - if they have
589
592
  * an issue with that they should have done it right in the first place.
590
593
  */
591
- #ifndef ECB_GCC_VERSION
592
- #if !defined __GNUC_MINOR__ || defined __INTEL_COMPILER || defined __SUNPRO_C || defined __SUNPRO_CC || defined __llvm__ || defined __clang__
593
- #define ECB_GCC_VERSION(major,minor) 0
594
- #else
595
- #define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
596
- #endif
594
+ #if !defined __GNUC_MINOR__ || defined __INTEL_COMPILER || defined __SUNPRO_C || defined __SUNPRO_CC || defined __llvm__ || defined __clang__
595
+ #define ECB_GCC_VERSION(major,minor) 0
596
+ #else
597
+ #define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
598
+ #endif
599
+
600
+ #define ECB_CLANG_VERSION(major,minor) (__clang_major__ > (major) || (__clang_major__ == (major) && __clang_minor__ >= (minor)))
601
+
602
+ #if __clang__ && defined __has_builtin
603
+ #define ECB_CLANG_BUILTIN(x) __has_builtin (x)
604
+ #else
605
+ #define ECB_CLANG_BUILTIN(x) 0
606
+ #endif
607
+
608
+ #if __clang__ && defined __has_extension
609
+ #define ECB_CLANG_EXTENSION(x) __has_extension (x)
610
+ #else
611
+ #define ECB_CLANG_EXTENSION(x) 0
597
612
  #endif
598
613
 
599
614
  #define ECB_CPP (__cplusplus+0)
@@ -633,13 +648,18 @@ struct signalfd_siginfo
633
648
  #define ECB_MEMORY_FENCE do { } while (0)
634
649
  #endif
635
650
 
651
+ /* http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/compiler_ref/compiler_builtins.html */
652
+ #if __xlC__ && ECB_CPP
653
+ #include <builtins.h>
654
+ #endif
655
+
636
656
  #ifndef ECB_MEMORY_FENCE
637
657
  #if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110
638
658
  #if __i386 || __i386__
639
659
  #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory")
640
660
  #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
641
661
  #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
642
- #elif __amd64 || __amd64__ || __x86_64 || __x86_64__
662
+ #elif ECB_GCC_AMD64
643
663
  #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory")
644
664
  #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory")
645
665
  #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
@@ -687,16 +707,11 @@ struct signalfd_siginfo
687
707
  #define ECB_MEMORY_FENCE_ACQUIRE __atomic_thread_fence (__ATOMIC_ACQUIRE)
688
708
  #define ECB_MEMORY_FENCE_RELEASE __atomic_thread_fence (__ATOMIC_RELEASE)
689
709
 
690
- /* The __has_feature syntax from clang is so misdesigned that we cannot use it
691
- * without risking compile time errors with other compilers. We *could*
692
- * define our own ecb_clang_has_feature, but I just can't be bothered to work
693
- * around this shit time and again.
694
- * #elif defined __clang && __has_feature (cxx_atomic)
695
- * // see comment below (stdatomic.h) about the C11 memory model.
696
- * #define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST)
697
- * #define ECB_MEMORY_FENCE_ACQUIRE __c11_atomic_thread_fence (__ATOMIC_ACQUIRE)
698
- * #define ECB_MEMORY_FENCE_RELEASE __c11_atomic_thread_fence (__ATOMIC_RELEASE)
699
- */
710
+ #elif ECB_CLANG_EXTENSION(c_atomic)
711
+ /* see comment below (stdatomic.h) about the C11 memory model. */
712
+ #define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST)
713
+ #define ECB_MEMORY_FENCE_ACQUIRE __c11_atomic_thread_fence (__ATOMIC_ACQUIRE)
714
+ #define ECB_MEMORY_FENCE_RELEASE __c11_atomic_thread_fence (__ATOMIC_RELEASE)
700
715
 
701
716
  #elif ECB_GCC_VERSION(4,4) || defined __INTEL_COMPILER || defined __clang__
702
717
  #define ECB_MEMORY_FENCE __sync_synchronize ()
@@ -769,7 +784,7 @@ struct signalfd_siginfo
769
784
 
770
785
  /*****************************************************************************/
771
786
 
772
- #if __cplusplus
787
+ #if ECB_CPP
773
788
  #define ecb_inline static inline
774
789
  #elif ECB_GCC_VERSION(2,5)
775
790
  #define ecb_inline static __inline__
@@ -793,47 +808,79 @@ typedef int ecb_bool;
793
808
  #define ECB_CONCAT(a, b) ECB_CONCAT_(a, b)
794
809
  #define ECB_STRINGIFY_(a) # a
795
810
  #define ECB_STRINGIFY(a) ECB_STRINGIFY_(a)
811
+ #define ECB_STRINGIFY_EXPR(expr) ((expr), ECB_STRINGIFY_ (expr))
796
812
 
797
813
  #define ecb_function_ ecb_inline
798
814
 
799
- #if ECB_GCC_VERSION(3,1)
800
- #define ecb_attribute(attrlist) __attribute__(attrlist)
801
- #define ecb_is_constant(expr) __builtin_constant_p (expr)
802
- #define ecb_expect(expr,value) __builtin_expect ((expr),(value))
803
- #define ecb_prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality)
815
+ #if ECB_GCC_VERSION(3,1) || ECB_CLANG_VERSION(2,8)
816
+ #define ecb_attribute(attrlist) __attribute__ (attrlist)
804
817
  #else
805
818
  #define ecb_attribute(attrlist)
819
+ #endif
806
820
 
821
+ #if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_constant_p)
822
+ #define ecb_is_constant(expr) __builtin_constant_p (expr)
823
+ #else
807
824
  /* possible C11 impl for integral types
808
825
  typedef struct ecb_is_constant_struct ecb_is_constant_struct;
809
826
  #define ecb_is_constant(expr) _Generic ((1 ? (struct ecb_is_constant_struct *)0 : (void *)((expr) - (expr)), ecb_is_constant_struct *: 0, default: 1)) */
810
827
 
811
828
  #define ecb_is_constant(expr) 0
829
+ #endif
830
+
831
+ #if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_expect)
832
+ #define ecb_expect(expr,value) __builtin_expect ((expr),(value))
833
+ #else
812
834
  #define ecb_expect(expr,value) (expr)
835
+ #endif
836
+
837
+ #if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_prefetch)
838
+ #define ecb_prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality)
839
+ #else
813
840
  #define ecb_prefetch(addr,rw,locality)
814
841
  #endif
815
842
 
816
843
  /* no emulation for ecb_decltype */
817
- #if ECB_GCC_VERSION(4,5)
818
- #define ecb_decltype(x) __decltype(x)
819
- #elif ECB_GCC_VERSION(3,0)
820
- #define ecb_decltype(x) __typeof(x)
844
+ #if ECB_CPP11
845
+ // older implementations might have problems with decltype(x)::type, work around it
846
+ template<class T> struct ecb_decltype_t { typedef T type; };
847
+ #define ecb_decltype(x) ecb_decltype_t<decltype (x)>::type
848
+ #elif ECB_GCC_VERSION(3,0) || ECB_CLANG_VERSION(2,8)
849
+ #define ecb_decltype(x) __typeof__ (x)
821
850
  #endif
822
851
 
823
852
  #if _MSC_VER >= 1300
824
- #define ecb_deprecated __declspec(deprecated)
853
+ #define ecb_deprecated __declspec (deprecated)
825
854
  #else
826
855
  #define ecb_deprecated ecb_attribute ((__deprecated__))
827
856
  #endif
828
857
 
829
- #define ecb_noinline ecb_attribute ((__noinline__))
858
+ #if _MSC_VER >= 1500
859
+ #define ecb_deprecated_message(msg) __declspec (deprecated (msg))
860
+ #elif ECB_GCC_VERSION(4,5)
861
+ #define ecb_deprecated_message(msg) ecb_attribute ((__deprecated__ (msg))
862
+ #else
863
+ #define ecb_deprecated_message(msg) ecb_deprecated
864
+ #endif
865
+
866
+ #if _MSC_VER >= 1400
867
+ #define ecb_noinline __declspec (noinline)
868
+ #else
869
+ #define ecb_noinline ecb_attribute ((__noinline__))
870
+ #endif
871
+
830
872
  #define ecb_unused ecb_attribute ((__unused__))
831
873
  #define ecb_const ecb_attribute ((__const__))
832
874
  #define ecb_pure ecb_attribute ((__pure__))
833
875
 
834
- /* http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx __declspec(noreturn) */
835
- #if ECB_C11
876
+ #if ECB_C11 || __IBMC_NORETURN
877
+ /* http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/language_ref/noreturn.html */
836
878
  #define ecb_noreturn _Noreturn
879
+ #elif ECB_CPP11
880
+ #define ecb_noreturn [[noreturn]]
881
+ #elif _MSC_VER >= 1200
882
+ /* http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx */
883
+ #define ecb_noreturn __declspec (noreturn)
837
884
  #else
838
885
  #define ecb_noreturn ecb_attribute ((__noreturn__))
839
886
  #endif
@@ -858,7 +905,10 @@ typedef int ecb_bool;
858
905
  #define ecb_unlikely(expr) ecb_expect_false (expr)
859
906
 
860
907
  /* count trailing zero bits and count # of one bits */
861
- #if ECB_GCC_VERSION(3,4)
908
+ #if ECB_GCC_VERSION(3,4) \
909
+ || (ECB_CLANG_BUILTIN(__builtin_clz) && ECB_CLANG_BUILTIN(__builtin_clzll) \
910
+ && ECB_CLANG_BUILTIN(__builtin_ctz) && ECB_CLANG_BUILTIN(__builtin_ctzll) \
911
+ && ECB_CLANG_BUILTIN(__builtin_popcount))
862
912
  /* we assume int == 32 bit, long == 32 or 64 bit and long long == 64 bit */
863
913
  #define ecb_ld32(x) (__builtin_clz (x) ^ 31)
864
914
  #define ecb_ld64(x) (__builtin_clzll (x) ^ 63)
@@ -867,8 +917,8 @@ typedef int ecb_bool;
867
917
  #define ecb_popcount32(x) __builtin_popcount (x)
868
918
  /* no popcountll */
869
919
  #else
870
- ecb_function_ int ecb_ctz32 (uint32_t x) ecb_const;
871
- ecb_function_ int
920
+ ecb_function_ ecb_const int ecb_ctz32 (uint32_t x);
921
+ ecb_function_ ecb_const int
872
922
  ecb_ctz32 (uint32_t x)
873
923
  {
874
924
  int r = 0;
@@ -892,16 +942,16 @@ typedef int ecb_bool;
892
942
  return r;
893
943
  }
894
944
 
895
- ecb_function_ int ecb_ctz64 (uint64_t x) ecb_const;
896
- ecb_function_ int
945
+ ecb_function_ ecb_const int ecb_ctz64 (uint64_t x);
946
+ ecb_function_ ecb_const int
897
947
  ecb_ctz64 (uint64_t x)
898
948
  {
899
949
  int shift = x & 0xffffffffU ? 0 : 32;
900
950
  return ecb_ctz32 (x >> shift) + shift;
901
951
  }
902
952
 
903
- ecb_function_ int ecb_popcount32 (uint32_t x) ecb_const;
904
- ecb_function_ int
953
+ ecb_function_ ecb_const int ecb_popcount32 (uint32_t x);
954
+ ecb_function_ ecb_const int
905
955
  ecb_popcount32 (uint32_t x)
906
956
  {
907
957
  x -= (x >> 1) & 0x55555555;
@@ -912,8 +962,8 @@ typedef int ecb_bool;
912
962
  return x >> 24;
913
963
  }
914
964
 
915
- ecb_function_ int ecb_ld32 (uint32_t x) ecb_const;
916
- ecb_function_ int ecb_ld32 (uint32_t x)
965
+ ecb_function_ ecb_const int ecb_ld32 (uint32_t x);
966
+ ecb_function_ ecb_const int ecb_ld32 (uint32_t x)
917
967
  {
918
968
  int r = 0;
919
969
 
@@ -926,8 +976,8 @@ typedef int ecb_bool;
926
976
  return r;
927
977
  }
928
978
 
929
- ecb_function_ int ecb_ld64 (uint64_t x) ecb_const;
930
- ecb_function_ int ecb_ld64 (uint64_t x)
979
+ ecb_function_ ecb_const int ecb_ld64 (uint64_t x);
980
+ ecb_function_ ecb_const int ecb_ld64 (uint64_t x)
931
981
  {
932
982
  int r = 0;
933
983
 
@@ -937,20 +987,20 @@ typedef int ecb_bool;
937
987
  }
938
988
  #endif
939
989
 
940
- ecb_function_ ecb_bool ecb_is_pot32 (uint32_t x) ecb_const;
941
- ecb_function_ ecb_bool ecb_is_pot32 (uint32_t x) { return !(x & (x - 1)); }
942
- ecb_function_ ecb_bool ecb_is_pot64 (uint64_t x) ecb_const;
943
- ecb_function_ ecb_bool ecb_is_pot64 (uint64_t x) { return !(x & (x - 1)); }
990
+ ecb_function_ ecb_const ecb_bool ecb_is_pot32 (uint32_t x);
991
+ ecb_function_ ecb_const ecb_bool ecb_is_pot32 (uint32_t x) { return !(x & (x - 1)); }
992
+ ecb_function_ ecb_const ecb_bool ecb_is_pot64 (uint64_t x);
993
+ ecb_function_ ecb_const ecb_bool ecb_is_pot64 (uint64_t x) { return !(x & (x - 1)); }
944
994
 
945
- ecb_function_ uint8_t ecb_bitrev8 (uint8_t x) ecb_const;
946
- ecb_function_ uint8_t ecb_bitrev8 (uint8_t x)
995
+ ecb_function_ ecb_const uint8_t ecb_bitrev8 (uint8_t x);
996
+ ecb_function_ ecb_const uint8_t ecb_bitrev8 (uint8_t x)
947
997
  {
948
998
  return ( (x * 0x0802U & 0x22110U)
949
- | (x * 0x8020U & 0x88440U)) * 0x10101U >> 16;
999
+ | (x * 0x8020U & 0x88440U)) * 0x10101U >> 16;
950
1000
  }
951
1001
 
952
- ecb_function_ uint16_t ecb_bitrev16 (uint16_t x) ecb_const;
953
- ecb_function_ uint16_t ecb_bitrev16 (uint16_t x)
1002
+ ecb_function_ ecb_const uint16_t ecb_bitrev16 (uint16_t x);
1003
+ ecb_function_ ecb_const uint16_t ecb_bitrev16 (uint16_t x)
954
1004
  {
955
1005
  x = ((x >> 1) & 0x5555) | ((x & 0x5555) << 1);
956
1006
  x = ((x >> 2) & 0x3333) | ((x & 0x3333) << 2);
@@ -960,8 +1010,8 @@ ecb_function_ uint16_t ecb_bitrev16 (uint16_t x)
960
1010
  return x;
961
1011
  }
962
1012
 
963
- ecb_function_ uint32_t ecb_bitrev32 (uint32_t x) ecb_const;
964
- ecb_function_ uint32_t ecb_bitrev32 (uint32_t x)
1013
+ ecb_function_ ecb_const uint32_t ecb_bitrev32 (uint32_t x);
1014
+ ecb_function_ ecb_const uint32_t ecb_bitrev32 (uint32_t x)
965
1015
  {
966
1016
  x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);
967
1017
  x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2);
@@ -974,71 +1024,80 @@ ecb_function_ uint32_t ecb_bitrev32 (uint32_t x)
974
1024
 
975
1025
  /* popcount64 is only available on 64 bit cpus as gcc builtin */
976
1026
  /* so for this version we are lazy */
977
- ecb_function_ int ecb_popcount64 (uint64_t x) ecb_const;
978
- ecb_function_ int
1027
+ ecb_function_ ecb_const int ecb_popcount64 (uint64_t x);
1028
+ ecb_function_ ecb_const int
979
1029
  ecb_popcount64 (uint64_t x)
980
1030
  {
981
1031
  return ecb_popcount32 (x) + ecb_popcount32 (x >> 32);
982
1032
  }
983
1033
 
984
- ecb_inline uint8_t ecb_rotl8 (uint8_t x, unsigned int count) ecb_const;
985
- ecb_inline uint8_t ecb_rotr8 (uint8_t x, unsigned int count) ecb_const;
986
- ecb_inline uint16_t ecb_rotl16 (uint16_t x, unsigned int count) ecb_const;
987
- ecb_inline uint16_t ecb_rotr16 (uint16_t x, unsigned int count) ecb_const;
988
- ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) ecb_const;
989
- ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) ecb_const;
990
- ecb_inline uint64_t ecb_rotl64 (uint64_t x, unsigned int count) ecb_const;
991
- ecb_inline uint64_t ecb_rotr64 (uint64_t x, unsigned int count) ecb_const;
992
-
993
- ecb_inline uint8_t ecb_rotl8 (uint8_t x, unsigned int count) { return (x >> ( 8 - count)) | (x << count); }
994
- ecb_inline uint8_t ecb_rotr8 (uint8_t x, unsigned int count) { return (x << ( 8 - count)) | (x >> count); }
995
- ecb_inline uint16_t ecb_rotl16 (uint16_t x, unsigned int count) { return (x >> (16 - count)) | (x << count); }
996
- ecb_inline uint16_t ecb_rotr16 (uint16_t x, unsigned int count) { return (x << (16 - count)) | (x >> count); }
997
- ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) { return (x >> (32 - count)) | (x << count); }
998
- ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) { return (x << (32 - count)) | (x >> count); }
999
- ecb_inline uint64_t ecb_rotl64 (uint64_t x, unsigned int count) { return (x >> (64 - count)) | (x << count); }
1000
- ecb_inline uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << (64 - count)) | (x >> count); }
1001
-
1002
- #if ECB_GCC_VERSION(4,3)
1034
+ ecb_inline ecb_const uint8_t ecb_rotl8 (uint8_t x, unsigned int count);
1035
+ ecb_inline ecb_const uint8_t ecb_rotr8 (uint8_t x, unsigned int count);
1036
+ ecb_inline ecb_const uint16_t ecb_rotl16 (uint16_t x, unsigned int count);
1037
+ ecb_inline ecb_const uint16_t ecb_rotr16 (uint16_t x, unsigned int count);
1038
+ ecb_inline ecb_const uint32_t ecb_rotl32 (uint32_t x, unsigned int count);
1039
+ ecb_inline ecb_const uint32_t ecb_rotr32 (uint32_t x, unsigned int count);
1040
+ ecb_inline ecb_const uint64_t ecb_rotl64 (uint64_t x, unsigned int count);
1041
+ ecb_inline ecb_const uint64_t ecb_rotr64 (uint64_t x, unsigned int count);
1042
+
1043
+ ecb_inline ecb_const uint8_t ecb_rotl8 (uint8_t x, unsigned int count) { return (x >> ( 8 - count)) | (x << count); }
1044
+ ecb_inline ecb_const uint8_t ecb_rotr8 (uint8_t x, unsigned int count) { return (x << ( 8 - count)) | (x >> count); }
1045
+ ecb_inline ecb_const uint16_t ecb_rotl16 (uint16_t x, unsigned int count) { return (x >> (16 - count)) | (x << count); }
1046
+ ecb_inline ecb_const uint16_t ecb_rotr16 (uint16_t x, unsigned int count) { return (x << (16 - count)) | (x >> count); }
1047
+ ecb_inline ecb_const uint32_t ecb_rotl32 (uint32_t x, unsigned int count) { return (x >> (32 - count)) | (x << count); }
1048
+ ecb_inline ecb_const uint32_t ecb_rotr32 (uint32_t x, unsigned int count) { return (x << (32 - count)) | (x >> count); }
1049
+ ecb_inline ecb_const uint64_t ecb_rotl64 (uint64_t x, unsigned int count) { return (x >> (64 - count)) | (x << count); }
1050
+ ecb_inline ecb_const uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << (64 - count)) | (x >> count); }
1051
+
1052
+ #if ECB_GCC_VERSION(4,3) || (ECB_CLANG_BUILTIN(__builtin_bswap32) && ECB_CLANG_BUILTIN(__builtin_bswap64))
1053
+ #if ECB_GCC_VERSION(4,8) || ECB_CLANG_BUILTIN(__builtin_bswap16)
1054
+ #define ecb_bswap16(x) __builtin_bswap16 (x)
1055
+ #else
1003
1056
  #define ecb_bswap16(x) (__builtin_bswap32 (x) >> 16)
1057
+ #endif
1004
1058
  #define ecb_bswap32(x) __builtin_bswap32 (x)
1005
1059
  #define ecb_bswap64(x) __builtin_bswap64 (x)
1060
+ #elif _MSC_VER
1061
+ #include <stdlib.h>
1062
+ #define ecb_bswap16(x) ((uint16_t)_byteswap_ushort ((uint16_t)(x)))
1063
+ #define ecb_bswap32(x) ((uint32_t)_byteswap_ulong ((uint32_t)(x)))
1064
+ #define ecb_bswap64(x) ((uint64_t)_byteswap_uint64 ((uint64_t)(x)))
1006
1065
  #else
1007
- ecb_function_ uint16_t ecb_bswap16 (uint16_t x) ecb_const;
1008
- ecb_function_ uint16_t
1066
+ ecb_function_ ecb_const uint16_t ecb_bswap16 (uint16_t x);
1067
+ ecb_function_ ecb_const uint16_t
1009
1068
  ecb_bswap16 (uint16_t x)
1010
1069
  {
1011
1070
  return ecb_rotl16 (x, 8);
1012
1071
  }
1013
1072
 
1014
- ecb_function_ uint32_t ecb_bswap32 (uint32_t x) ecb_const;
1015
- ecb_function_ uint32_t
1073
+ ecb_function_ ecb_const uint32_t ecb_bswap32 (uint32_t x);
1074
+ ecb_function_ ecb_const uint32_t
1016
1075
  ecb_bswap32 (uint32_t x)
1017
1076
  {
1018
1077
  return (((uint32_t)ecb_bswap16 (x)) << 16) | ecb_bswap16 (x >> 16);
1019
1078
  }
1020
1079
 
1021
- ecb_function_ uint64_t ecb_bswap64 (uint64_t x) ecb_const;
1022
- ecb_function_ uint64_t
1080
+ ecb_function_ ecb_const uint64_t ecb_bswap64 (uint64_t x);
1081
+ ecb_function_ ecb_const uint64_t
1023
1082
  ecb_bswap64 (uint64_t x)
1024
1083
  {
1025
1084
  return (((uint64_t)ecb_bswap32 (x)) << 32) | ecb_bswap32 (x >> 32);
1026
1085
  }
1027
1086
  #endif
1028
1087
 
1029
- #if ECB_GCC_VERSION(4,5)
1088
+ #if ECB_GCC_VERSION(4,5) || ECB_CLANG_BUILTIN(__builtin_unreachable)
1030
1089
  #define ecb_unreachable() __builtin_unreachable ()
1031
1090
  #else
1032
1091
  /* this seems to work fine, but gcc always emits a warning for it :/ */
1033
- ecb_inline void ecb_unreachable (void) ecb_noreturn;
1034
- ecb_inline void ecb_unreachable (void) { }
1092
+ ecb_inline ecb_noreturn void ecb_unreachable (void);
1093
+ ecb_inline ecb_noreturn void ecb_unreachable (void) { }
1035
1094
  #endif
1036
1095
 
1037
1096
  /* try to tell the compiler that some condition is definitely true */
1038
1097
  #define ecb_assume(cond) if (!(cond)) ecb_unreachable (); else 0
1039
1098
 
1040
- ecb_inline unsigned char ecb_byteorder_helper (void) ecb_const;
1041
- ecb_inline unsigned char
1099
+ ecb_inline ecb_const unsigned char ecb_byteorder_helper (void);
1100
+ ecb_inline ecb_const unsigned char
1042
1101
  ecb_byteorder_helper (void)
1043
1102
  {
1044
1103
  /* the union code still generates code under pressure in gcc, */
@@ -1047,7 +1106,7 @@ ecb_byteorder_helper (void)
1047
1106
  /* the reason why we have this horrible preprocessor mess */
1048
1107
  /* is to avoid it in all cases, at least on common architectures */
1049
1108
  /* or when using a recent enough gcc version (>= 4.6) */
1050
- #if __i386 || __i386__ || _M_X86 || __amd64 || __amd64__ || _M_X64
1109
+ #if ((__i386 || __i386__) && !__VOS__) || _M_IX86 || ECB_GCC_AMD64 || ECB_MSVC_AMD64
1051
1110
  return 0x44;
1052
1111
  #elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
1053
1112
  return 0x44;
@@ -1063,10 +1122,10 @@ ecb_byteorder_helper (void)
1063
1122
  #endif
1064
1123
  }
1065
1124
 
1066
- ecb_inline ecb_bool ecb_big_endian (void) ecb_const;
1067
- ecb_inline ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; }
1068
- ecb_inline ecb_bool ecb_little_endian (void) ecb_const;
1069
- ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; }
1125
+ ecb_inline ecb_const ecb_bool ecb_big_endian (void);
1126
+ ecb_inline ecb_const ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; }
1127
+ ecb_inline ecb_const ecb_bool ecb_little_endian (void);
1128
+ ecb_inline ecb_const ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; }
1070
1129
 
1071
1130
  #if ECB_GCC_VERSION(3,0) || ECB_C99
1072
1131
  #define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0))
@@ -1074,7 +1133,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
1074
1133
  #define ecb_mod(m,n) ((m) < 0 ? ((n) - 1 - ((-1 - (m)) % (n))) : ((m) % (n)))
1075
1134
  #endif
1076
1135
 
1077
- #if __cplusplus
1136
+ #if ECB_CPP
1078
1137
  template<typename T>
1079
1138
  static inline T ecb_div_rd (T val, T div)
1080
1139
  {
@@ -1108,7 +1167,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
1108
1167
  /* the only noteworthy exception is ancient armle, which uses order 43218765 */
1109
1168
  #if 0 \
1110
1169
  || __i386 || __i386__ \
1111
- || __amd64 || __amd64__ || __x86_64 || __x86_64__ \
1170
+ || ECB_GCC_AMD64 \
1112
1171
  || __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ \
1113
1172
  || defined __s390__ || defined __s390x__ \
1114
1173
  || defined __mips__ \
@@ -1118,7 +1177,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
1118
1177
  || defined __m68k__ \
1119
1178
  || defined __m88k__ \
1120
1179
  || defined __sh__ \
1121
- || defined _M_IX86 || defined _M_AMD64 || defined _M_IA64 \
1180
+ || defined _M_IX86 || defined ECB_MSVC_AMD64 || defined _M_IA64 \
1122
1181
  || (defined __arm__ && (defined __ARM_EABI__ || defined __EABI__ || defined __VFP_FP__ || defined _WIN32_WCE || defined __ANDROID__)) \
1123
1182
  || defined __aarch64__
1124
1183
  #define ECB_STDFP 1
@@ -1144,17 +1203,25 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
1144
1203
  #define ECB_NAN ECB_INFINITY
1145
1204
  #endif
1146
1205
 
1206
+ #if ECB_C99 || _XOPEN_VERSION >= 600 || _POSIX_VERSION >= 200112L
1207
+ #define ecb_ldexpf(x,e) ldexpf ((x), (e))
1208
+ #define ecb_frexpf(x,e) frexpf ((x), (e))
1209
+ #else
1210
+ #define ecb_ldexpf(x,e) (float) ldexp ((double) (x), (e))
1211
+ #define ecb_frexpf(x,e) (float) frexp ((double) (x), (e))
1212
+ #endif
1213
+
1147
1214
  /* converts an ieee half/binary16 to a float */
1148
- ecb_function_ float ecb_binary16_to_float (uint16_t x) ecb_const;
1149
- ecb_function_ float
1215
+ ecb_function_ ecb_const float ecb_binary16_to_float (uint16_t x);
1216
+ ecb_function_ ecb_const float
1150
1217
  ecb_binary16_to_float (uint16_t x)
1151
1218
  {
1152
1219
  int e = (x >> 10) & 0x1f;
1153
1220
  int m = x & 0x3ff;
1154
1221
  float r;
1155
1222
 
1156
- if (!e ) r = ldexpf ((float)m , -24);
1157
- else if (e != 31) r = ldexpf ((float)m + 0x400, e - 25);
1223
+ if (!e ) r = ecb_ldexpf (m , -24);
1224
+ else if (e != 31) r = ecb_ldexpf (m + 0x400, e - 25);
1158
1225
  else if (m ) r = ECB_NAN;
1159
1226
  else r = ECB_INFINITY;
1160
1227
 
@@ -1162,8 +1229,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
1162
1229
  }
1163
1230
 
1164
1231
  /* convert a float to ieee single/binary32 */
1165
- ecb_function_ uint32_t ecb_float_to_binary32 (float x) ecb_const;
1166
- ecb_function_ uint32_t
1232
+ ecb_function_ ecb_const uint32_t ecb_float_to_binary32 (float x);
1233
+ ecb_function_ ecb_const uint32_t
1167
1234
  ecb_float_to_binary32 (float x)
1168
1235
  {
1169
1236
  uint32_t r;
@@ -1180,7 +1247,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
1180
1247
  if (x < -3.40282346638528860e+38f) return 0xff800000U;
1181
1248
  if (x != x ) return 0x7fbfffffU;
1182
1249
 
1183
- m = frexpf (x, &e) * 0x1000000U;
1250
+ m = ecb_frexpf (x, &e) * 0x1000000U;
1184
1251
 
1185
1252
  r = m & 0x80000000U;
1186
1253
 
@@ -1202,8 +1269,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
1202
1269
  }
1203
1270
 
1204
1271
  /* converts an ieee single/binary32 to a float */
1205
- ecb_function_ float ecb_binary32_to_float (uint32_t x) ecb_const;
1206
- ecb_function_ float
1272
+ ecb_function_ ecb_const float ecb_binary32_to_float (uint32_t x);
1273
+ ecb_function_ ecb_const float
1207
1274
  ecb_binary32_to_float (uint32_t x)
1208
1275
  {
1209
1276
  float r;
@@ -1223,7 +1290,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
1223
1290
  e = 1;
1224
1291
 
1225
1292
  /* we distrust ldexpf a bit and do the 2**-24 scaling by an extra multiply */
1226
- r = ldexpf (x * (0.5f / 0x800000U), e - 126);
1293
+ r = ecb_ldexpf (x * (0.5f / 0x800000U), e - 126);
1227
1294
 
1228
1295
  r = neg ? -r : r;
1229
1296
  #endif
@@ -1232,8 +1299,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
1232
1299
  }
1233
1300
 
1234
1301
  /* convert a double to ieee double/binary64 */
1235
- ecb_function_ uint64_t ecb_double_to_binary64 (double x) ecb_const;
1236
- ecb_function_ uint64_t
1302
+ ecb_function_ ecb_const uint64_t ecb_double_to_binary64 (double x);
1303
+ ecb_function_ ecb_const uint64_t
1237
1304
  ecb_double_to_binary64 (double x)
1238
1305
  {
1239
1306
  uint64_t r;
@@ -1272,8 +1339,8 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
1272
1339
  }
1273
1340
 
1274
1341
  /* converts an ieee double/binary64 to a double */
1275
- ecb_function_ double ecb_binary64_to_double (uint64_t x) ecb_const;
1276
- ecb_function_ double
1342
+ ecb_function_ ecb_const double ecb_binary64_to_double (uint64_t x);
1343
+ ecb_function_ ecb_const double
1277
1344
  ecb_binary64_to_double (uint64_t x)
1278
1345
  {
1279
1346
  double r;
@@ -2111,7 +2178,7 @@ downheap (ANHE *heap, int N, int k)
2111
2178
 
2112
2179
  heap [k] = heap [c];
2113
2180
  ev_active (ANHE_w (heap [k])) = k;
2114
-
2181
+
2115
2182
  k = c;
2116
2183
  }
2117
2184
 
@@ -2263,7 +2330,7 @@ evpipe_write (EV_P_ EV_ATOMIC_T *flag)
2263
2330
  #ifdef _WIN32
2264
2331
  WSABUF buf;
2265
2332
  DWORD sent;
2266
- buf.buf = (CHAR*)&buf;
2333
+ buf.buf = &buf;
2267
2334
  buf.len = 1;
2268
2335
  WSASend (EV_FD_TO_WIN32_HANDLE (evpipe [1]), &buf, 1, &sent, 0, 0, 0);
2269
2336
  #else
@@ -2531,7 +2598,7 @@ ev_supported_backends (void) EV_THROW
2531
2598
  if (EV_USE_EPOLL ) flags |= EVBACKEND_EPOLL;
2532
2599
  if (EV_USE_POLL ) flags |= EVBACKEND_POLL;
2533
2600
  if (EV_USE_SELECT) flags |= EVBACKEND_SELECT;
2534
-
2601
+
2535
2602
  return flags;
2536
2603
  }
2537
2604
 
@@ -3337,12 +3404,17 @@ time_update (EV_P_ ev_tstamp max_block)
3337
3404
 
3338
3405
  /* ########## COOLIO PATCHERY HO! ########## */
3339
3406
  #if defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
3407
+ struct ev_poll_args {
3408
+ struct ev_loop *loop;
3409
+ ev_tstamp waittime;
3410
+ };
3411
+
3340
3412
  static
3341
- VALUE ev_backend_poll(void **args)
3413
+ VALUE ev_backend_poll(void *ptr)
3342
3414
  {
3343
- struct ev_loop *loop = (struct ev_loop *)args[0];
3344
- ev_tstamp waittime = *(ev_tstamp *)args[1];
3345
- backend_poll (EV_A_ waittime);
3415
+ struct ev_poll_args *args = (struct ev_poll_args *)ptr;
3416
+ struct ev_loop *loop = args->loop;
3417
+ backend_poll (EV_A_ args->waittime);
3346
3418
  return Qnil;
3347
3419
  }
3348
3420
  #endif
@@ -3353,7 +3425,7 @@ ev_run (EV_P_ int flags)
3353
3425
  {
3354
3426
  /* ########## COOLIO PATCHERY HO! ########## */
3355
3427
  #if defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
3356
- void *poll_args[2];
3428
+ struct ev_poll_args poll_args;
3357
3429
  #endif
3358
3430
  /* ######################################## */
3359
3431
 
@@ -3478,9 +3550,6 @@ ev_run (EV_P_ int flags)
3478
3550
  /*
3479
3551
  ########################## COOLIO PATCHERY HO! ##########################
3480
3552
 
3481
- The original patch file is made by Tony Arcieri.
3482
- https://github.com/celluloid/nio4r/blob/680143345726c5a64bb22376ca8fc3c6857019ae/ext/libev/ruby_gil.patch.
3483
-
3484
3553
  According to the grandwizards of Ruby, locking and unlocking of the global
3485
3554
  interpreter lock are apparently too powerful a concept for a mere mortal to
3486
3555
  wield (although redefining what + and - do to numbers is totally cool).
@@ -3505,7 +3574,15 @@ other and thus cannot be composed.
3505
3574
  And thus we are left with no choice but to patch the internals of libev in
3506
3575
  order to release a mutex at just the precise moment.
3507
3576
 
3508
- Let this be a lesson to the all: CALLBACKS FUCKING BLOW
3577
+ This is a great example of a situation where granular locking and unlocking
3578
+ of the GVL is practically required. The goal is to get as close to the
3579
+ system call as possible, and to keep the GVL unlocked for the shortest
3580
+ amount of time possible.
3581
+
3582
+ Perhaps Ruby could benefit from such an API, e.g:
3583
+
3584
+ rb_thread_unsafe_dangerous_crazy_blocking_region_begin(...);
3585
+ rb_thread_unsafe_dangerous_crazy_blocking_region_end(...);
3509
3586
 
3510
3587
  #######################################################################
3511
3588
  */
@@ -3517,19 +3594,17 @@ Let this be a lesson to the all: CALLBACKS FUCKING BLOW
3517
3594
 
3518
3595
  #ifndef HAVE_RB_THREAD_CALL_WITHOUT_GVL
3519
3596
  #ifdef HAVE_RB_THREAD_BLOCKING_REGION
3520
-
3521
3597
  #define rb_thread_call_without_gvl(func, data1, ubf, data2) \
3522
3598
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
3523
-
3524
3599
  #endif
3525
3600
  #endif
3526
3601
 
3527
3602
  #if defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
3528
- poll_args[0] = (void *)loop;
3529
- poll_args[1] = (void *)&waittime;
3603
+ poll_args.loop = loop;
3604
+ poll_args.waittime = waittime;
3530
3605
  rb_thread_call_without_gvl(ev_backend_poll, (void *)&poll_args, RUBY_UBF_IO, 0);
3531
3606
  #else
3532
- backend_poll (EV_A_ waittime);
3607
+ backend_poll (EV_A_ waittime);
3533
3608
  #endif
3534
3609
  /*
3535
3610
  ############################# END PATCHERY ############################
@@ -4977,4 +5052,3 @@ ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_THROW
4977
5052
  #if EV_MULTIPLICITY
4978
5053
  #include "ev_wrap.h"
4979
5054
  #endif
4980
-
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libev native API header
3
3
  *
4
- * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann <libev@schmorp.de>
4
+ * Copyright (c) 2007,2008,2009,2010,2011,2012,2015 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-
@@ -42,12 +42,16 @@
42
42
 
43
43
  #ifdef __cplusplus
44
44
  # define EV_CPP(x) x
45
+ # if __cplusplus >= 201103L
46
+ # define EV_THROW noexcept
47
+ # else
48
+ # define EV_THROW throw ()
49
+ # endif
45
50
  #else
46
51
  # define EV_CPP(x)
52
+ # define EV_THROW
47
53
  #endif
48
54
 
49
- #define EV_THROW EV_CPP(throw())
50
-
51
55
  EV_CPP(extern "C" {)
52
56
 
53
57
  /*****************************************************************************/
@@ -148,6 +152,8 @@ EV_CPP(extern "C" {)
148
152
 
149
153
  typedef double ev_tstamp;
150
154
 
155
+ #include <string.h> /* for memmove */
156
+
151
157
  #ifndef EV_ATOMIC_T
152
158
  # include <signal.h>
153
159
  # define EV_ATOMIC_T sig_atomic_t volatile
@@ -205,7 +211,7 @@ struct ev_loop;
205
211
  /*****************************************************************************/
206
212
 
207
213
  #define EV_VERSION_MAJOR 4
208
- #define EV_VERSION_MINOR 19
214
+ #define EV_VERSION_MINOR 20
209
215
 
210
216
  /* eventmask, revents, events... */
211
217
  enum {
@@ -660,7 +666,7 @@ EV_API_DECL void ev_set_userdata (EV_P_ void *data) EV_THROW;
660
666
  EV_API_DECL void *ev_userdata (EV_P) EV_THROW;
661
667
  typedef void (*ev_loop_callback)(EV_P);
662
668
  EV_API_DECL void ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_THROW;
663
- /* C++ doesn't allow the use of the ev_loop_callback typedef here, so we need to spell it out*/
669
+ /* C++ doesn't allow the use of the ev_loop_callback typedef here, so we need to spell it out */
664
670
  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;
665
671
 
666
672
  EV_API_DECL unsigned int ev_pending_count (EV_P) EV_THROW; /* number of pending events, if any */
@@ -715,7 +721,8 @@ EV_API_DECL void ev_resume (EV_P) EV_THROW;
715
721
  #define ev_is_pending(ev) (0 + ((ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */
716
722
  #define ev_is_active(ev) (0 + ((ev_watcher *)(void *)(ev))->active) /* ro, true when the watcher has been started */
717
723
 
718
- #define ev_cb(ev) (ev)->cb /* rw */
724
+ #define ev_cb_(ev) (ev)->cb /* rw */
725
+ #define ev_cb(ev) (memmove (&ev_cb_ (ev), &((ev_watcher *)(ev))->cb, sizeof (ev_cb_ (ev))), (ev)->cb)
719
726
 
720
727
  #if EV_MINPRI == EV_MAXPRI
721
728
  # define ev_priority(ev) ((ev), EV_MINPRI)
@@ -728,7 +735,7 @@ EV_API_DECL void ev_resume (EV_P) EV_THROW;
728
735
  #define ev_periodic_at(ev) (+((ev_watcher_time *)(ev))->at)
729
736
 
730
737
  #ifndef ev_set_cb
731
- # define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_)
738
+ # define ev_set_cb(ev,cb_) (ev_cb_ (ev) = (cb_), memmove (&((ev_watcher *)(ev))->cb, &ev_cb_ (ev), sizeof (ev_cb_ (ev))))
732
739
  #endif
733
740
 
734
741
  /* stopping (enabling, adding) a watcher does nothing if it is already running */
@@ -844,4 +851,3 @@ EV_API_DECL void ev_async_send (EV_P_ ev_async *w) EV_THROW;
844
851
  EV_CPP(})
845
852
 
846
853
  #endif
847
-
@@ -207,7 +207,10 @@ select_poll (EV_P_ ev_tstamp timeout)
207
207
  * (Visual C++ 12), it cause WaitForMultipleObjects stuck.
208
208
  */
209
209
  if (EV_WIN_FD_COUNT(vec_ri) == 0 && EV_WIN_FD_COUNT(vec_wi) == 0)
210
- return;
210
+ {
211
+ ev_sleep (timeout);
212
+ return;
213
+ }
211
214
  #endif
212
215
 
213
216
  EV_RELEASE_CB;
@@ -1,5 +1,5 @@
1
1
  module Coolio
2
- VERSION = "1.3.1"
2
+ VERSION = "1.4.0"
3
3
 
4
4
  def self.version
5
5
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cool.io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-21 00:00:00.000000000 Z
12
+ date: 2015-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  version: '0'
158
158
  requirements: []
159
159
  rubyforge_project:
160
- rubygems_version: 2.2.2
160
+ rubygems_version: 2.2.3
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: A cool framework for doing high performance I/O in Ruby