def _write(sign, t=None, enter=True, args=''): """""" if Sys.g.DEBUG : #~ DONT USE Sys.g.RLOCK isChildProc = not Sys.g_is_main_proc() bind_data = [] if t is not None : bind_data += Sys.pdate(t.timetuple() if enter else Sys.datetime.now().timetuple(), isChildProc) a, b, c, d, e = ('=> ' if enter else '<= '), '['+str(Sys.getpid()).rjust(5,' ')+']', ' '+sign+'(', Log._formatArgs(args), ') ' if not isChildProc : Sys.echo(a , Sys.CLZ_IO , False) Sys.echo(b , Sys.CLZ_PID if not isChildProc else Sys.CLZ_CPID, False) Sys.echo(c , Sys.CLZ_FUNC, False) try: Sys.echo(d , Sys.CLZ_ARGS, False) except : Sys.echo('?nr_arg?' , Sys.CLZ_ARGS, False) pass Sys.echo(e , Sys.CLZ_FUNC, False) bind_data += [(a, Const.CLZ_IO),(b, Const.CLZ_CPID if isChildProc else Const.CLZ_PID),(c , Const.CLZ_CFUNC if isChildProc else Const.CLZ_FUNC),(d , Const.CLZ_ARGS),(e , Const.CLZ_CFUNC if isChildProc else Const.CLZ_FUNC)] if not enter and t is not None : bind_data += Sys.pdelta(t, '', isChildProc) else : bind_data += Sys.dprint(dbcall=isChildProc) if isChildProc : Sys.sendMainProcMsg(1, bind_data) else : Sys.wlog(bind_data)
def mptask(id, *args, **kwargs): Sys.sendMainProcMsg(Manager.MSG_INIT, None) otask = task(id=id, event=event, *args, **kwargs) Sys.sendMainProcMsg(Manager.MSG_END, None) return otask