Page 1 of 1

Call for Suggestions -- Improved Event Flags

PostPosted: Wed Oct 09, 2002 4:12 am
by aek
Hi All.

First, read this:

Now, the question: What kind of interface would you as users like in terms of signaling the eFlag?

Right now, you can set or clear bits in the eFlag using a mask and an option. You cannot, for example, toggle bits, nor can you do more than a single operation at a time. This is not efficient.

I think it would be much more useful if you could perform multiple operations on an eFlag at once, within a single call to OSSignalEFlag(). E.g. you could clear bits 7-4, toggle bit 3, set bit 2 and clear bits 1-0 based on some other condition. Wouldn't that be neat?

To me, the ideal way to do this is to super-generalize it, in that a call to OSSignalEFlag() would look something like:

OSSignalEFlag(ecbP, MyEFlagSignalingFn());

char MyEFlagSignalingFn(ecbP)

operates on the specified eFlag as you wish. OSSignalEFlag() would call your function, then see if the resultant eFlag should wake an eligible waiting task ...

On the OS_WaitEflag() side, you would also define a function -- this one would look like

OStypeErr MyEFlagWaitingFn(ecbP)

which would simply return TRUE or FALSE based on whether the eFlag is the value you expect it to be for the task to successfully wait the eFlag.

You can have as many of your own different eFlag signaling and waiting functions as you like ... The current eFlag API would be replaced with this ...

So, what do you think?


[This message has been edited by aek (edited October 09, 2002).]

Re: Call for Suggestions -- Improved Event Flags

PostPosted: Wed Oct 09, 2002 4:27 am
by jtemples
I use event flags almost exclusively for my inter-task communications. My usage paradigm is always signal a single bit, wait on multiple bits. Each of the waited-on bits has an individual meaning; I haven't had any need to assign meaning to combinations of bits. I don't know if that's a common usage scenario for other folks.

In other words, I'm happy with the API as it is now.

Re: Call for Suggestions -- Improved Event Flags

PostPosted: Tue Oct 15, 2002 1:12 am
by luben

I think that this is the perfect solution for the event flags - to have a function that tracks the event flags. I don't know how to say it, but this is just what I wished from the event flags from their beginning. One of the reason not to use very often event flags in current SALVO was the limited set of possible logical operation over them. With the user defined function you make event flags extremely powerful and in the same time flexible. Excellent...

This will make possible for example to track pins of the uP, variables, counters,.... everything.

Well, from other side you should keep in mind that this will increase the kernel and maybe it will slow down the performance.

Best regards

Re: Call for Suggestions -- Improved Event Flags

PostPosted: Tue Oct 15, 2002 3:12 am
by aek
Hi Luben.

I think the kernel will actually shrink, and will run faster.

The user will have to do a bit more work to configure the eFlags ... but we'll provided canned routines to do the functionality (any|all|exact bits) that is currently there, so in many cases user's won't have to write their own functions.