dtas.git  about / heads / tags
duct tape audio suite for *nix
blob e15bd2f0cdab543ee7e2858442eff8d3cc668d32 591 bytes (raw)
$ git show v0.0.0:lib/dtas/writable_iter.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
# -*- encoding: binary -*-
# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net>
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
require_relative '../dtas'

module DTAS::WritableIter # :nodoc:
  attr_accessor :on_writable

  def writable_iter_init
    @on_writable = nil
  end

  # this is used to exchange our own writable status for the readable
  # status of the DTAS::Buffer which triggered us.
  def writable_iter
    if owr = @on_writable
      @on_writable = nil
      owr.call # this triggers readability watching of DTAS::Buffer
    end
    :ignore
  end
end

git clone git://80x24.org/dtas.git
git clone https://80x24.org/dtas.git