select-based event loop