<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):
 """Stops the worker threads and waits for them to finish"""

        self.working = False
        for w in self.workers:
            w.join()
        self.workers = []