Paolo Gai wrote: > Gilles Chanteperdrix wrote: > >Working around this issue means using calls to unlocked versions of libc > >functions protected with Xenomai POSIX mutexes, such as, for example, > >myputs and myputchar (sufficient for Paolo example) defined as : > >[...] > > > > > Ok! I tried it, and I also tried another slightly modified version of > the demo, that simply replaces putchars with an unprotected array of > chars (let's suppose there are no race conditions) that is printed out > to stdout at the end of the game.
There is no race condition in the SCHED_FIFO case or ahem, there should be none. Please also note that the "volatile" qualifier seem misplaced in your declaration of buf_current, it may matter since the compiler will probably inline calls to myputchar in the "medium" function, and buf_current will end up in a register. But this would have no effect only in the SCHED_FIFO case. > the results are the following, where the first part is RR and the second > is FIFO (it's quite strange for me that FIFO has more contect changes > than RR (?)) Please also note that any thread created with the SCHED_RR attribute will be a plain Linux thread, and due to a bug in glibc, the thread will use the default policy. The results are strange indeed for SCHED_FIFO, it may be a bug, this needs a closer look... Maybe threads are not Xenomai threads using SCHED_FIFO policy at all ? -- Gilles Chanteperdrix. _______________________________________________ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help