Subject:
Re: [ruby-ffi] Catching signals with trap.
From:
Matijs van Zuijlen
Date:
11/11/11 3:47 AM
To:
ruby-ffi@googlegroups.com

On 11/06/2011 05:59 PM, meh. wrote:
I'm writing a window manager in Ruby using my x11 binding/wrapper in
ruby-ffi but I'm having a small problem with signals.

If the process is in a XNextEvent waiting for a new event and I send a
signal to the process it doesn't call the block until an event
arrives.

Is there a way to make signals work within the ruby-ffi API or do I
have to bind to the signal function and do it ugly?

Have you considered binding and using XCB? Or even skipping the C part and implementing the X protocol in Ruby? The old RubyX11 library did this, and you could probably generate something straight from XML, which is how XCB is generated.

Anyway, this would allow you to work asynchronously and not have your program wait for XNextEvent to return.

Regards,
-- 
Matijs