<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stop(self):
 """Stop thread."""

        if self._thread:
            self.signal.put("Stop")
            self._thread.join()
            if self._soc:
                self._soc.shutdown()
                self._soc.close()
            self._thread = None