Skip to content

Instantly share code, notes, and snippets.

@kui
Created May 23, 2012 14:04
Show Gist options
  • Save kui/2775406 to your computer and use it in GitHub Desktop.
Save kui/2775406 to your computer and use it in GitHub Desktop.
別スレッドで select 呼んで、メインスレッドで uinput に書き込みをしようとするとブロックされたままになってしまう現象の再現コード
# -*- coding:utf-8; mode:ruby; -*-
t = Thread.new do
select nil, nil, nil, 1
puts 'timeout select(2)'
end
open '/dev/uinput', 'w' do |f|
f.syswrite 'foo' # block
end
t.join
@kui
Copy link
Author

kui commented May 23, 2012

syswritewrite にすると問題ない

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment