how to emit signal from one thread to another thread give example code