Revert "removed unused on_thread_told_to_stop"

This reverts commit fe451b757e0864639752605c163ebb0d11efe492.