about summary refs log tree commit homepage
path: root/lib/yahns/sigevent_efd.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yahns/sigevent_efd.rb')
-rw-r--r--lib/yahns/sigevent_efd.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/yahns/sigevent_efd.rb b/lib/yahns/sigevent_efd.rb
new file mode 100644
index 0000000..8f10ad6
--- /dev/null
+++ b/lib/yahns/sigevent_efd.rb
@@ -0,0 +1,18 @@
+# -*- encoding: binary -*-
+# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
+# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
+class Yahns::Sigevent < SleepyPenguin::EventFD # :nodoc:
+  include Kgio::DefaultWaiters
+  def self.new
+    super(0, SleepyPenguin::EventFD::CLOEXEC)
+  end
+
+  def sev_signal
+    incr(1) # eventfd_write
+  end
+
+  def yahns_step
+    value(true) # eventfd_read, we ignore this data
+    :wait_readable
+  end
+end