def _assign_new_thread_id(self, recursive=True):
self.__class__.thread_id_pool += <NUM_LIT:1><EOL>self.thread_id = self.__class__.thread_id_pool<EOL>if not recursive:<EOL><INDENT>return self.thread_id<EOL><DEDENT>for child in self:<EOL><INDENT>child.thread_id = self.thread_id<EOL><DEDENT>return self.thread_id<EOL>
Assigns a new thread id to the task.

:type  recursive: bool
:param recursive: Whether to assign the id to children recursively.
:rtype:  bool
:returns: The new thread id.