<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 server and all its threads. """

        try:
            self.running = False
            logger.info('Waiting tasks to finish...')
            self.queue.join()
            self.socket.close()
            logger.info('Exiting (C-Ctrl again to force it)...')
        except KeyboardInterrupt:
            logger.info('Forced.')
            sys.exit(1)