Closed rudolph9 closed 7 years ago
@nex3 I'm curious you've had a chance to review my pull request.
Can you please rebase this on master and In will review.
I've reviewed this PR.
Unfortuantely
fix_encoding(@native[:name].to_ptr.read_string())
doesn't work as the ptr is 0 length.
Using fpathconf is a good idea and I've merged that.
Using poll is probably beyond the scope of this gem at this point in time, but an interesting idea.
The pull makes three important changes:
@stop
flag.IO#select
/Native#poll
(depending onruby_support_io?
) are called in a loop with a 1 second timeout prior to making the blockingIO#readpartial
/Native#read
call. Upon timeout the@stop
flag is checked. Should the flag be set the method returns nil otherwise the loop continues and another call toIO#select
/Native#poll
is made.:name
was added to theNative::Event
struct and used accordingly in theEvent
class.Native#fpathconf
which accesses the running systemsNAME_MAX
system variable rather than arbitrarily using64 * Native::Event.size
.