def start_if_necessary(self):
self.lock.acquire()<EOL>try:<EOL><INDENT>if not self.listening:<EOL><INDENT>self.init()<EOL>self.listening = True<EOL>self.listening_thread = Thread(target=self.listen)<EOL>self.listening_thread.daemon = True<EOL>self.listening_thread.start()<EOL>self.processing_thread = Thread(target=self.process)<EOL>self.processing_thread.daemon = True<EOL>self.processing_thread.start()<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>self.lock.release()<EOL><DEDENT>
Starts the listening thread if it wans't already.