Implement platform-independent wrapper for poll()