/* Stop the reader thread (if it is running)  */
static int stop_reader(struct tip_cygwin *priv)
/* Stop the reader thread (if it is running)  */
static int stop_reader(struct tip_cygwin *priv)
{
	if (priv->tc_running == 1) {
		int tries = 3;
		priv->tc_running = 0;
		while ((priv->tc_running != -1) && tries--)
			sleep(1);
		if (tries <= 0)
			return -1;
	}
	return 0;
}