position of task variable codes
Fernando RUIZ CASAS
correo at fernando-ruiz.com
Sun Apr 14 16:29:01 UTC 2002
You can see this resolved in privateenv.c
BRGDSFernando RUIZ CASAS
home: correo at fernando-ruiz.com
work: fernando.ruiz at ctv.es
> -----Mensaje original-----
> De: Joel Sherrill [mailto:joel at OARcorp.com]
> Enviado el: sabado, 13 de abril de 2002 20:20
> Para: Eric Norum
> CC: Joe Black; rtems-users at oarcorp.com
> Asunto: Re: position of task variable codes
>
>
>
>
> Eric Norum wrote:
> >
> > On Friday, April 12, 2002, at 08:38 PM, Joe Black wrote:
> >
> > > Hi, all
> > >
> > > Dose the position of rtems_task_variable_add must be in
> the task?
> >
> > Yes, the rtems_task_variable_add directive tells RTEMS to add the
> > specified variable to the task-switch context of the*calling* task.
> >
> > >
> > >
> ------------------------------------------------------------------
> -----------------
> > >
> > > my case:
> > > in init_task
> > > create task1
> > > call rtems_task_variable_add to add task1's variable
> > > start task1
> > >
> > > create task2 (with the same priority of task1)
> > > call rtems_task_variable_add to add task2's variable
> > > start task2
> > >
> >
> > The above code adds the variable to the `init' task twice, so task1 and
> > task2 still use the `global' (not per-task) value of the variable.
> >
> > > delete init_task and task1 run
> > >
> > > printf task1's variable
> > >
> > > suspend task1 and task2 run
> > >
> > > printf task2's variable
> > >
> > > resume task1
> > >
> > > suspend task2 and task1 run
> > >
> > > in task1, printf its variable, it failed :(
> > >
> > > resume task2 and suspend task1
> > >
> > > in task2, printf its variable, failed too
> > >
> > >
> ------------------------------------------------------------------
> -----------------
> > >
> > > I can guarantee the parameters passed to rtems_task_variable_add
> > > are OK in the case above.
> > > If I put the rtems_task_variable_add in task1 or task2,
> it works well
> > >
> > > Could anyone tell me how I can resolve the problem? 3x.
> >
> > It sounds like you have already solved it. To add a variable to a
> > task's context you must call rtems_task_variable_add from that task.
> > From then on any changes made to that variable by that task will be
> > local to the task.
>
> Joe.. did you look for this information in the user's manual? If you
> did
> and didn't find it, please submit a patch. :)
>
> > --
> > Eric Norum <eric.norum at usask.ca>
> > Department of Electrical Engineering
> > University of Saskatchewan
> > Saskatoon, Canada.
> > Phone: (306) 966-5394 FAX: (306) 966-5407
>
> --
> Joel Sherrill, Ph.D. Director of Research & Development
> joel at OARcorp.com On-Line Applications Research
> Ask me about RTEMS: a free RTOS Huntsville AL 35805
> Support Available (256) 722-9985
>
More information about the users
mailing list