pthread to listen