a simple version of libev, only io event, code is from tb