def __check_system(self):
        running = lu.all_tasks()
        if running:
            raise SystemCorrupted("%d tasks already running!" % running)

        sched = lu.scheduler()
        if sched != "Linux":
            raise SystemCorrupted("Scheduler is %s, should be Linux" % sched)
    def __to_linux(self):
        msgs = []

        sched = lu.scheduler()
        if sched != "Linux":
            self.log("Switching back to Linux scheduler")
            try:
                lu.switch_scheduler("Linux")
            except:
                msgs += ["Scheduler is %s, cannot switch to Linux!" % sched]

        running = lu.all_tasks()
        if running:
            msgs += ["%d real-time tasks still running!" % running]

        if msgs:
            raise SystemCorrupted("\n".join(msgs))
    def __to_linux(self):
        msgs = []

        sched = lu.scheduler()
        if sched != "Linux":
            self.log("Switching back to Linux scheduler")
            try:
                lu.switch_scheduler("Linux")
            except:
                msgs += ["Scheduler is %s, cannot switch to Linux!" % sched]

        running = lu.all_tasks()
        if running:
            msgs += ["%d real-time tasks still running!" % running]

        if msgs:
            raise SystemCorrupted("\n".join(msgs))