Method: ConcurrentSHM::Channel::Unbuffered::Fixed.new

Defined in:
lib/concurrent-shm/channel.rb

.new(shm, width:, offset: 0, autosize: true) ⇒ Object

Allocates an unbuffered, fixed-width channel with the specified width.

Raises:

  • (RangeError)

    if the width is less than 1

See Also:



44
45
46
47
48
49
50
51
52
# File 'lib/concurrent-shm/channel.rb', line 44

def self.new(shm, width:, offset: 0, autosize: true)
  raise RangeError, "Width must be > 0" unless width > 0

  alloc(shm, 2 + width, offset: offset, autosize: autosize) do |body|
    @state = body[0].as_intptr
    @closed = body[1].as_intptr
    @data = body[2..]
  end
end