synchronizing init task with an arbitrary number of worker tasks

Joel Sherrill Joel.Sherrill at OARcorp.com
Wed Sep 26 12:07:13 UTC 2012


With automatic barriers, it is just a matter of including the init task in the count. With manual barriers, you would be monitoring when to release
Like the message queue solution.

With barriers I think you can ask how many tasks are currently blocked which is a way of monitoring.

Andrei Dimitrief-Jianu <andrei.dimitrief.jianu at gmail.com> wrote:


Yes, I could use a barrier w/ RTEMS_BARRIER_AUTOMATIC_RELEASE.
However, I would prevent from finishing the tasks that I want to
synchronize (probably this is the reason why barriers are recommended
for the initialization phase). I need something that would let the
workers to finish and keep a count of how many of them have finished,
and when that count is reached it would release the init task as well.

What I was looking for was a synchronization event that could be
described by an API similar to:

rtems_status_code rtems_synch_event_initialize( rtems_synch_event
*synch_event, int wait_count );

rtems_status_code rtems_synch_event_wait_one( rtems_synch_event *synch_event );

rtems_status_code rtems_synch_event_wait_all( rtems_synch_event *synch_event );

rtems_status_code rtems_synch_event_set( rtems_synch_event *synch_event );

rtems_status_code rtems_synch_event_reset( rtems_synch_event *synch_event );


Regards,
Andrei.


On Tue, Sep 25, 2012 at 7:48 PM, Gedare Bloom <gedare at rtems.org> wrote:
> A barrier should work.
> http://rtems.org/onlinedocs/doc-current/share/rtems/html/c_user/c_user_225.html#Barrier-Manager
>
> On Tue, Sep 25, 2012 at 6:30 PM, Andrei Dimitrief-Jianu
> <andrei.dimitrief.jianu at gmail.com> wrote:
>> Hello,
>>
>> I have an arbitrary number of worker tasks created and started in the
>> init task. I would like to have the init task wait on all of them to
>> finish and perform an exit() afterwards.
>>
>> Anyone can suggest a pattern to use for synchronization?
>>
>> Thank you!
>> _______________________________________________
>> rtems-users mailing list
>> rtems-users at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-users
_______________________________________________
rtems-users mailing list
rtems-users at rtems.org
http://www.rtems.org/mailman/listinfo/rtems-users




More information about the users mailing list