use Anyevent; ... some code ... event loop with a shoot_myself_in_the_mouth condvar ... shoot_myself_in_the_mouth->recv;