This is the mail archive of the
mailing list for the eCos project.
blocking for n events
- From: Heiko Panther <heiko dot panther at web dot de>
- To: ecos-discuss at sources dot redhat dot com
- Date: Thu, 08 Dec 2005 10:32:51 -0800
- Subject: [ECOS] blocking for n events
I have the following interesting synchronization problem.
I am triggering a random number of transaction. Only after the last one I will
know how many I actually triggered. Then I need to wait for all of them to complete.
In my imagination, I have a semaphore that I can decrease by n, and then wake up
when it was posted n times and so is back to 0.
However, eCos semaphores don't work that way, and maybe they seldomly do. So, do
you have a suggestion what to do instead? As I said, I don't have the number of
transcations before, so I can't just set a variable and decrease it from the
callback, and then trigger an event flag.
What I could do is to wait for the semaphore in a for() loop, but I want to
avoid the overhead of task switches.
while ( ! transaction->isLastTransaction);
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss