use libevent with pthread to handle socket in a async method.