def _write_source_global_funcs(self):
      code = C.sequence()
      code.extend(_genCommentHeader2('GLOBAL FUNCTIONS'))
      code.append(C.blank())      
      for task in sorted(self.os_cfg.tasks, key=lambda x: x.name):         
         code.append(C.line('OS_TASK_HANDLER({0.name}, arg)'.format(task)))
         code.append(self._generate_task_body(task))
         code.append(C.blank(2))
      return code