Double sema lock fixed, added EINTR handler to poll function