Add function argument to action to indicate whether ring buffer has space to write (if so, poll in specified direction)
read from fd only if space to write in ring buffer, modify available_to_write to prevent wraparound ambiguity