Add API for waiting on port events.