about summary refs log tree commit homepage
path: root/ext/sleepy_penguin/eventfd.c
DateCommit message (Collapse)
2017-03-16drop unused Ruby 1.8 support code
Ruby 1.8 is long dead and we already broke 1.9 support by using keyword args for splice, sendfile, and copy_file_range support.
2017-01-02unify rb_gc() handling for out-of-FD conditions
This should hopefully simplify logic a bit and avoid expensive access to errno.
2013-04-21favor comparison against 0 for error checking
When possible, comparisons against zero require one less load and uses one less register, so this results in smaller code: $ ~/linux/scripts/bloat-o-meter before.so after.so add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-57 (-57) function old new delta rm_watch 84 83 -1 rb_sp_set_nonblock 80 79 -1 add_watch 127 126 -1 epwait 692 687 -5 s_new 970 921 -49 This style is favored by major C projects, including glibc. Note: since file and file descriptor flags may eventually use more bits of an integer, we continue comparing F_GETFD/F_GETFL return values against -1 to be future proof.
2013-04-13set close-on-exec by default under Ruby 2.0
Ruby 2.0 creates file descriptors with the close-on-exec flag specified by default. Unless a user specifies flags explicitly, assume the default is to set the close-on-exec. This does not change behavior of Ruby 1.9 and earlier.
2013-03-01reload FD after rb_io_wait_*able functions
The file descriptor may be closed while GVL is released, so we must reload the descriptor before and after calling rb_io_wait_*able functions. We reload before calling rb_io_wait_*able because the GVL was released for the function call (read/write) which triggered EAGAIN. We reload after calling rb_io_wait_*able because rb_io_wait_*able releases the GVL, too.
2011-05-19better handle cross-thread close under Ruby 1.9.3
We don't want to operate on improper FDs in multithreaded environment. This affects MRI despite the GVL since file descriptors are usually allocated without the GVL held (open()/accept()).
2011-05-19use rb_call_super instead of calling for_fd
It's fewer lines of code and cleaner in cases where "new" and "for_fd" are the same underlying method.
2011-05-14eventfd: fix 32-bit warning for ULL type
Yes, people still use 32-bit machines
2011-05-14eventfd: fix getvalue argv type
Stupid typo :x
2011-03-10eventfd: remove "_nonblock" interfaces
Instead, allow a nonblock flag to be passed to EventFD#incr and EventFD#value so it matches other interfaces.
2011-03-10eventfd: test for :SEMAPHORE semantics
2011-03-10cleanup blocking region code for 1.8
Just reuse 1.9 methods
2011-03-10move set_nonblock() into util.c
No need to repeat it and bloat ourselves.
2011-03-10doc: improve RDoc documentation
Might as well, since it forces me to understand these interfaces, too :)
2011-03-10rework flags passing for ease-of-use
Arguments now take symbols and arrays of symbols just like the SignalFD.new method. This fixes some use of signed vs unsigned integer conversions as well.
2011-03-05eventfd.c: fixes for Ruby 1.9
Oops :X
2011-01-13minor doc updates, use wrongdoc
Switch documentation over to wrongdoc, no more JavaScript! Our documentation still sucks.
2010-09-26wire up EventFD class
This wraps the eventfd(2) interface of Linux. Like TimerFD, it is not available on older distributions.