python threading event wait keyboardinterrupt