>-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >On Behalf Of Gilles Chanteperdrix >Sent: mardi 30 octobre 2007 14:30 >To: Patrick >Cc: [email protected] >Subject: Re: [Xenomai-help] RT, nonRT communication > >On 10/30/07, Patrick <[EMAIL PROTECTED]> wrote: >> > -----Message d'origine----- >> > De: Gilles Chanteperdrix [mailto:[EMAIL PROTECTED] >> > Envoyé: mardi, 30. octobre 2007 10:52 >> > À: Patrick >> > Cc: [email protected] >> > Objet: Re: [Xenomai-help] TR: RT, nonRT communication >> > >> > On 10/30/07, Patrick <[EMAIL PROTECTED]> wrote: >> > > >> > > >> > > >> > > >> > > Hi, >> > > >> > > >> > > >> > > Is it possible to share a pthread_mutex between a rt task and a >linux >> > > pthread ? >> > >> > No, it is not possible >> > >> > > >> > > My two tasks must share resources and I must protect them against >> > concurrent >> > > access. >> > > >> > > If pthread_mutex is not the correct way to do it can you tell me >how to >> > > achieve this ? >> > >> > The way to handle these border line cases is to make your linux >> > pthread a xenomai thread running with the SCHED_OTHER scheduling >> > policy. Note that the main thread already has this property. >> > >> Ok, so if I understand I can't use a pthread_mutex between the main >thread >> and a rt_task ? > >You CAN use a xenomai pthread_mutex between the main thread and a >rt_task, the main thread is a xenomai thread running with the >SCHED_OTHER scheduling policy. >
I guess there is a misunderstanding of "main thread" here. The main thread should actually not be a xenomai thread since it belongs to a non-RT application. Patrick is actually using the Qt framework on a PXA device which of course is not a RT-domain application. The thing is that the Qt application should somehow retrieve some data issued from RT-application. Currently the Qt application is starting a Xenomai thread - by doing an extern "c" invokation from Qt - and the data list is shared between the main (qt-)thread (non-RT) and the Xenomai thread; that's why Patrick wanted to use a mutex. But indeed, as far as I know, it will be not possible to do that since the waiting queues on sync objects as mutex are managed differently (dealing with linux threads on the one hand, with Xenomai threads on the other hand) between the RT and non-RT domains. So the question would be: how can data be exchanged in a safe way between a non-RT domain and a RT-domain? >> If I want use pthread_mutex between another pthread and a rt_task, >must the >> pthred be running with SCHED_OTHER ? This value is the default value >for >> pthread ! > >The pthread must be a xenomai posix skin thread running with the >SCHED_OTHER policy. You can achieve this by creating this pthread with >xenomai wrapped pthread_create, or by setting its policy (assuming the >thread was created with the non wrapped pthread_create, i.e. >__real_pthread_create) with xenomai wrapped pthread_setschedparam. > >In other words, if you use Xenomai wrapped functions, everything >should be fine. Things become tricky when you decide to use __real_* >functions. > >-- > Gilles Chanteperdrix > >_______________________________________________ >Xenomai-help mailing list >[email protected] >https://mail.gna.org/listinfo/xenomai-help Daniel _______________________________________________ Xenomai-help mailing list [email protected] https://mail.gna.org/listinfo/xenomai-help
