<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 the JobManager thread. 		"""

		self.logger.debug('stopping the job manager')
		self._thread_running.clear()
		self._thread_shutdown.wait()
		self._job_lock.acquire()
		self.logger.debug('waiting on ' + str(len(self._jobs)) + ' job threads')
		for job_desc in self._jobs.values():
			if job_desc['job'] is None:
				continue
			if not job_desc['job'].is_alive():
				continue
			job_desc['job'].join()

		# the job lock must be released before the thread can be joined because the thread routine acquires it before
		# checking if it should exit, see https://github.com/zeroSteiner/smoke-zephyr/issues/4 for more details
		self._job_lock.release()
		self._thread.join()

		self.logger.info('the job manager has been stopped')
		return