From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 From: Leandro Bucci Date: Sun, 3 Jan 2021 21:29:24 +0100 Message-ID: Subject: Mode Switch Content-Type: text/plain; charset="UTF-8" List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xenomai@xenomai.org Hi, I have a strange behavior regarding the "mode switch". In the attached code, the task should never switch to the Linux domain, but instead I have a value of MSW = 2. How is it possible? Even if I do a printf in the task I always get MSW = 2. I can't understand where the problem is. #include #include #include #include #include RT_TASK task; RT_TASK_INFO info; void task_body(void *arg) { rt_task_inquire(NULL, &info); } int main() { int err; err = rt_task_create(&task, "mytask", 0, 1, 0); if (err != 0){ fprintf(stderr, "failed to create task\n"); exit(EXIT_FAILURE); } err = rt_task_start(&task, &task_body, NULL); if (err != 0){ fprintf(stderr, "failed to start task\n"); exit(EXIT_FAILURE); } sleep(5); //sleep for 5 seconds printf("mode switch = %d\n", (int)(info.stat.msw)); exit(EXIT_SUCCESS); }