resolvinf libevent synchronization issue