Use nonblocking APIs, support dispose for clean shutdown.