about summary refs log tree commit homepage
path: root/ext/sleepy_penguin
DateCommit message (Collapse)
2013-04-12inotify: use thread-local internal buffer
This gives us thread-safety for the internal buffer. While we're at it, cache-align this buffer to avoid unnecessary overhead when read() writes to it.
2013-04-12avoid ENOMEM checking in common code paths
ENOMEM from syscalls such as inotify_add_watch and epoll_ctl are from the lack of kernel memory, so even a successful rb_gc() is unlikely to be able to reap memory taken from those slab caches.
2013-04-12epoll: cache alignment for per-thread structure
This probably won't make a huge difference in Ruby, but perhaps one day the unnecessary dirtying of cache lines will affect performance (and we'll be ready when that day comes). While we're at it, remove usage of pthread* functions for thread-local variables. The __thread construct from GCC (and also implemented by clang) is much easier-to-use than the pthread_*specific API.
2013-04-12split Epoll and Epoll::IO, rewrite Epoll in Ruby
Epoll::IO is a dangerous, low-level class which is intended for users aware of the GC and fork behavior of epoll in the Linux kernel. Rewriting the higher-level Epoll in Ruby makes it easier to maintain, especially since Rubinius has no GVL while running C extensions.
2013-04-03util: comment explaining non-use of FIONBIO
I was about to change this to the FIONBIO here myself before I realized we do not frequently _change_ file flags.
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.
2013-01-24epoll: update documentation for multi-threaded use
We forgot to update this documentation when we released 3.1.0
2013-01-23epoll: use pthread_once properly
pthread_once_t must be static to be effective. This bug only affects apps which load sleepy_penguin multiple times.
2013-01-17epoll: add EPOLLWAKEUP constant
This was added in Linux 3.5 and glibc 2.17
2013-01-17Revert "epoll: avoid EPOLL_CTL_MOD race condition"
This reverts commit 02e5a91b24983d96b342c007661966495ccdb619. This workaround may have unintended side-effects for apps using EPOLL_CTL_DEL.
2013-01-03epoll: avoid EPOLL_CTL_MOD race condition
Until everybody updates to a version of the Linux kernel with this fix, we need to enable a workaround for older kernels using EPOLL_CTL_DEL + EPOLL_CTL_ADD to emulate EPOLL_CTL_MOD behavior. This race condition is fixed in Linux upstream commit 128dd1759d96ad36c379240f8b9463e8acfd37a1 and included in Linux v3.8-rc2 and later. This fix will likely be backported to stable and vendor kernels, so we'll whitelist them as we learn of them.
2012-05-02timerfd: remove unusable constants (never released)
timerfd currently (Linux 3.3.x) only supports CLOCK_REALTIME and CLOCK_MONOTONIC, and not every single clock supported by POSIX clocks.
2012-05-02epoll: update comment on free(NULL) usage
It's POSIX, and since epoll is Linux-only and Linux uses glibc which is pretty up-to-date w.r.t POSIX, we don't have to worry...
2012-03-22epoll: use per-thread data structure for concurrent Epoll#wait
This allows multiple threads to park on Epoll#wait (without holding onto the GVL). This allows a single, one-shot notification to wake up a single thread (another notification to a different IO object would wake up another thread). This allows using the same multi-threaded, EPOLLONESHOT-based design as cmogstored: http://bogomips.org/cmogstored/queues.txt
2012-03-22sleepy_penguin.h: add prototype for rb_thread_io_blocking_region
This function is exposed in the libruby-static archive for Ruby 1.9.3, but there is no publically-declared prototype for it.
2012-03-07epoll: split out ugly green thread code
It's ugly and confusing to look at, so split it out.
2011-07-26disable SignalFD interface
It's a waste of memory to have something that has no chance of working reliably with any existing Ruby runtimes.
2011-07-26rb_update_max_fd() support for epoll
This is the only descriptor we manage ourselves and don't use IO.for_fd with (epoll is quite "special" wrt fork).
2011-06-16fix unused variable warnings
Oops...
2011-06-15timerfd: add new constants from 2.6.39 and 3.0
We still need to document these. ref: http://www.man7.org/tlpi/api_changes/
2011-05-20epoll: avoid race condition in EINTR checking
Even if we timeout while getting an EINTR, we'll retry epoll_wait() with a zero timeout like IO.select does in Ruby to avoid raising Errno::EINTR.
2011-05-19disable operations on Fixnum file descriptors
It's too dangerous in the general case to support, and we doubt people ever used it.
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-19doc: Epoll::IO should NEVER be used directly
Really, don't do it.
2011-05-19signalfd: dis-recommend this class
It's too incompatible with the way Ruby handles signals.
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-19epoll.c: more descriptive IOError for closed descriptors
Makes error reporting easier, we think.
2011-05-19Epoll#wait does not expose EINTR to user
It's more consistent with IO#read/IO#write/IO.select in MRI.
2011-05-19epoll -signal
2011-05-19inotify: hold GVL on close
We should get this fixed properly in MRI, and Inotify descriptors aren't often closed anyways...
2011-05-19epoll: close notifies other threads under MRI
rb_thread_fd_close is in both MRI 1.8 and MRI 1.9.3dev
2011-05-19epoll.c: note that close() never fails under Linux
ref: Linux kernel sources
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-04-28extconf: don't abort for rb_memerror and rb_io_close()
May not detected properly
2011-04-10epoll: better deal with cross thread close
Probably not an issue under Linux
2011-04-10inotify: disable GVL-releasing close for 1.9.3dev
Ruby 1.9.3 will release the GVL for IO#close
2011-03-10signalfd.c: fix whitespace
2011-03-10inotify: release GVL during Inotify#close on 1.9
close(2) on inotify descriptors takes forever and a day.
2011-03-10inotify: add Inotify#each method for yielding each event
This is useful for processing events in a synchronous fashion, we think...
2011-03-10inotify.c: fix local variable name for RDoc
"in" is a keyword in Ruby and unusable as a local variable
2011-03-10signalfd: attempt to support POSIX real-time signals
I know of no other way to support them in Ruby
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-10TimerFD#expirations takes a nonblock flag
Just like Inotify#take
2011-03-10eventfd: test for :SEMAPHORE semantics
2011-03-10signalfd: flesh out SignalFD#take with non-blocking
Not that it works well...
2011-03-10Inotify#take releases GVL unconditionally
Avoids using select(2) if we want blocking functionality on Ruby 1.9.
2011-03-10split out missing bits for older glibc and kernels
They could be useful for other projects.
2011-03-10cleanup blocking region code for 1.8
Just reuse 1.9 methods
2011-03-10cleanup unneeded #define shortcuts
Never used anywhere