Sha256: e1e2a8f5934f9b5d2d51c54da7c88d41aff71817a69f47b8b215b1edbf45abf6
Contents?: true
Size: 508 Bytes
Versions: 9
Compression:
Stored size: 508 Bytes
Contents
# frozen_string_literal: true module Polyphony # Event watcher for thread-safe synchronisation class Event def initialize @i, @o = IO.pipe end def await Thread.current.agent.read(@i, +'', 8192, false) raise @value if @value.is_a?(Exception) @value end def await_no_raise Thread.current.agent.read(@i, +'', 8192, false) @value end def signal(value = nil) @value = value Thread.current.agent.write(@o, '1') end end end
Version data entries
9 entries across 9 versions & 1 rubygems