I was going to point out that there cannot be a race condition because all loads and stores to s->events are guarded by a mutex but I see now that uv_is_readable() and uv_is_writable() are called uv__stream_osx_select() outside of any critical sections... That should be addressed.