Pumpkin, Inc.

Pumpkin User Forums

Tasks waiting on the same event flag

If you can't make Salvo do what you want it to do, post it here.

Tasks waiting on the same event flag

Postby aek » Wed Oct 09, 2002 3:40 am

Hello.

Don't bother sending the sample project -- what you observed is the correct behavior for the code as it is written.

We've issued a Service Bulletin SB-14 for it:http://www.pumpkininc.com/ubb/Forum12/HTML/000014.html. Be sure to read it ...

However, that doesn't mean that it is the expected or documented behavior, does it?

Salvo's internal workings with eFlags are different from all other event types. What is happening is that each time an eFlag is signaled, all the tasks that wait the eFlag wake up / are made eligible, and then they all run and analyze whether the event (with option and mask) they are waiting on has occurred. Therefore any task that waits an eFlag with a timeout will wake up whenever the eFlag is signaled.

As you can see, the current eFlag implementation leaves something to be desired ...

But never fear, I believe there is a way that we can implement more advanced eFlags, solve this timeout problem and improve performance at the same time. The idea is for the user to define an arbitrary "event flag validating function" for each task+eFlag combo. This way, you're not limited to the options (ANY|ALL|EXACT_BITS) that we currently provide. The trick in all this is to minimize RAM usage, and I think I now see an elegant way to do it ... but this improvement will not come before the v3.1.x release ...

For now, keep on doing what you've been doing. It costs you a small amount of RAM (one ecb and one efcb), but you'll actually get better system performance that way.

Regards

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Tasks waiting on the same event flag

Postby jtemples » Wed Oct 09, 2002 3:51 am

Thanks for the clarification.

Just so that I'm clear on the Service Bulletin,

quote:

This will solve the timeout problem, but only if the eFlag is set (signaled) with exactly the mask and options with which the task is waiting the eFlag.

I can still, for example, wait on a mask of 0xF0 with OSANY_BITS, and signal a single bit, and timeouts will work correctly?

jtemples
 
Posts: 45
Joined: Tue Jul 16, 2002 11:00 pm

Re: Tasks waiting on the same event flag

Postby aek » Wed Oct 09, 2002 4:02 am

Hello.
quote:
I can still, for example, wait on a mask of 0xF0 with OSANY_BITS, and signal a single bit, and timeouts will work correctly?
The task will timeout if the eFlag is not signaled within the timeout period. If the eFlag is signaled within the timeout period, even by, say, setting bit 0 (i.e. xxxxxxx1 is the result), then the task will not timeout. But since in your case I believe you will only signal the eFlag in question with bits 7-4, then you'll be OK.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Tasks waiting on the same event flag

Postby jtemples » Wed Oct 09, 2002 4:06 am

I wasn't clear; I should have said "signal a single bit in the wait mask." It sounds like that's going to work ok.
jtemples
 
Posts: 45
Joined: Tue Jul 16, 2002 11:00 pm

Re: Tasks waiting on the same event flag

Postby aek » Wed Oct 09, 2002 4:15 am

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Tasks waiting on the same event flag

Postby jtemples » Wed Oct 09, 2002 10:39 am

I've run into this situtation on a couple of projects now, but I haven't taken the time to try to build a small test case. I'm wondering if this is something in the manual I've overlooked.

I have two tasks, A and B, and an event flag E.

Task A waits on event flag E with mask 0xF0 and no timeout.

Task B waits on event flag E with mask 0x0F and a timeout.

Some combination of circumstances causes task B's timeout to never happen, although it continues to receive event flags. Timeouts are still working elsewhere in the code, as are OS_Delay calls.

Giving task B its own event flag solves the problem.

jtemples
 
Posts: 45
Joined: Tue Jul 16, 2002 11:00 pm

Re: Tasks waiting on the same event flag

Postby aek » Wed Oct 09, 2002 10:41 am

Hello.

Doesn't seem like you're doing anything wrong -- can you make up a small project that exhibits this problem and email it to support@pumpkininc.com?

Thanks,

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests

cron