Class: ConcurrentSHM::Channel::Unbuffered::Empty
- Inherits:
-
ConcurrentSHM::Channel::Unbuffered
- Object
- ConcurrentSHM::Channel
- ConcurrentSHM::Channel::Unbuffered
- ConcurrentSHM::Channel::Unbuffered::Empty
- Defined in:
- lib/concurrent-shm/channel.rb
Overview
An unbuffered channel with zero-width packets.
Class Method Summary collapse
-
.new(shm, offset: 0, autosize: true) ⇒ Object
Allocates an unbuffered, zero-width channel.
Instance Method Summary collapse
-
#recv ⇒ nil
Receive a zero-width packet over the channel.
-
#send ⇒ nil
Send a zero-width packet over the channel.
Methods inherited from ConcurrentSHM::Channel
Class Method Details
.new(shm, offset: 0, autosize: true) ⇒ Object
Allocates an unbuffered, zero-width channel.
18 19 20 21 22 23 |
# File 'lib/concurrent-shm/channel.rb', line 18 def self.new(shm, offset: 0, autosize: true) alloc(shm, 2, offset: offset, autosize: autosize) do |body| @state = body[0].as_intptr @closed = body[1].as_intptr end end |
Instance Method Details
#recv ⇒ nil
Receive a zero-width packet over the channel. Blocks if there are no senders.
34 35 36 |
# File 'lib/concurrent-shm/channel.rb', line 34 def recv do_recv end |
#send ⇒ nil
Send a zero-width packet over the channel. Blocks if there are no receivers.
28 29 30 |
# File 'lib/concurrent-shm/channel.rb', line 28 def send do_send end |