rtems_iterate_over_all_threads hangs the application

Leon Pollak leonp at plris.com
Fri Apr 24 16:07:36 UTC 2009


On Friday April 24 2009, Manuel Coutinho wrote:
> On top of my head, I would say you are also suspending the idle thread
> (which you should not)
Thanks, Manuel.
Your idea seems to me correct - this may be the only difference (as I can 
imagine) between my code and rtems_iterate_over_all_threads() call.
So, I need to avoid suspension of the 0x0a010000 task, yes?
Is there any other way to know the idle task ID?

Thanks.
>
>
>
>   _____
>
> From: rtems-users-bounces at rtems.org [mailto:rtems-users-bounces at rtems.org]
> On Behalf Of Leon Pollak
> Sent: Thursday, April 23, 2009 1:59 PM
> To: rtems-users at rtems.com.
> Subject: rtems_iterate_over_all_threads hangs the application
>
>
>
> Hello, all (mainly Joel :-)
>
> I used the following code to stop the running system for "snapshot":
> --------------------------------
> inline rtems_id GetSelfTaskId() {
> return(_Thread_Executing->Object.id);
> }
>
> inline void __help_suspend__(Thread_Control *the_thread) {
> if (GetSelfTaskId() != the_thread->Object.id)
> rtems_task_suspend(the_thread->Object.id);
> }
>
> inline void AllTasks() {
> rtems_iterate_over_all_threads(__help_suspend__);
> }
> --------------------------------
> And then the following code to run this:
>
> AllTasks();
> rtems_wake_after(400);
> Reset();
>
> When I stop after AllTasks() and print out the tasks state, I see that all
> tasks except the current one are suspended - OK.
> Now, when I try to sleep, the application hangs.
> Looking into debugger, I see that control reaches the _Thread_Dispatch
> function via _Thread_Set_state() and _Thread_Calculate_heir().
> The last does
> _Thread_Heir = (Thread_Control *)
> _Thread_Ready_chain[ _Priority_Get_highest() ].first;
>
> and returns very small value (0xc8), which goes to the _Thread_Heir value
> with the crash result at the end.
>
> ---
> I substituted call to AllTasks() with the code:
> for(uint i = 0x0a010001; i <= 0x0a010020; i++) {
> if (i == _Thread_Executing->Object.id) continue;
> rtems_task_suspend(i); }
> And everything worked fine.
>
>
>
>
>
> My assumption is that _Priority_Get_highest() does not return correct value
> (as there are no tasks), but...
>
>
>
>
>
>
> Many thanks ahead for any comment.
>
> Leon


-- 
            Dr.Leon M.Pollak
                Director
       PLR Information Systems Ltd.
Tel.:+972-98657670  |  POB 8130, H'Aomanut 9,
Fax.:+972-98657621  |  Poleg Industrial Zone,
Mob.:+972-544739246 |  Netanya, 42160, Israel.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20090424/d61cbd6b/attachment-0001.html>


More information about the users mailing list