Suspending Tasks before they are finished

Jerzy J yuralogplus at gmail.com
Mon Mar 14 13:59:14 UTC 2022


Hi Joel,

Thanks for the explanation! It was in the context of Classic API.

All the best,
Jerzy

pon., 14 mar 2022 o 13:12 Joel Sherrill <joel at rtems.org> napisał(a):

>
>
> On Mon, Mar 14, 2022 at 6:44 AM Jerzy J <yuralogplus at gmail.com> wrote:
>
>> Hi,
>>
>> I've been developing some tests and observed some task behaviour that i
>> can't understand and couldn't find any documentation about it.
>>
>> I have tests where I create 2 extra tasks (Workers) and then those tasks
>> are blocked and unlocked using semaphores and barriers. However, whenever
>> main task (Runner) is about to get blocked, the test crashes (just
>> finishes
>> instantly). In some configurations is seems to "deadlock" on a semaphore
>> instead, while it should be able to move forward.
>>
>> I realised that if I suspend the Worker tasks before they are about to
>> finish, with for e.g:
>> `rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events
>> );`
>> line at the very end of worker execution, it all works as expected.
>>
>
> If these are Classic API tasks (e.g. rtems_task_create) and they are
> falling off
> the bottom of the function that is the task body, that's a fatal error. If
> it is a POSIX
> thread, it silently goes away.
>
>>
>> Do you maybe know what is the reason for such behaviour? I'm also not sure
>> in which state is the task after it finishes it's execution but before it
>> is deleted, is it 'blocked' or is it 'dormant'?
>>
>
> Depends on the API and attributes on a pthread.
>
> --joel
>
>>
>> Thanks and all the best,
>> Jerzy
>> _______________________________________________
>> users mailing list
>> users at rtems.org
>> http://lists.rtems.org/mailman/listinfo/users
>>
>


More information about the users mailing list