Callback function receiving the signal from WriteThread