Class: ConcurrentSHM::Channel::SingleBuffered::Empty
- Inherits:
-
ConcurrentSHM::Channel::SingleBuffered
- Object
- ConcurrentSHM::Channel
- ConcurrentSHM::Channel::SingleBuffered
- ConcurrentSHM::Channel::SingleBuffered::Empty
- Defined in:
- lib/concurrent-shm/channel.rb
Overview
A single-buffered channel with zero-width packets.
Class Method Summary collapse
-
.new(shm, offset: 0, autosize: true) ⇒ Object
Allocates a single-buffered, 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 a single-buffered, zero-width channel.
150 151 152 153 154 155 |
# File 'lib/concurrent-shm/channel.rb', line 150 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 the buffer is empty.
163 164 165 |
# File 'lib/concurrent-shm/channel.rb', line 163 def recv do_recv end |
#send ⇒ nil
Send a zero-width packet over the channel. Blocks if the buffer is full.
158 159 160 |
# File 'lib/concurrent-shm/channel.rb', line 158 def send do_send end |