-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Atomevent #16
base: master
Are you sure you want to change the base?
Atomevent #16
Conversation
This implements a simple event notification system which can signal up to implementation defined number of bits, suitable for signalling to threads from ISRs and callbacks. Proper tested ports are avr.
…ted. This introduces changes in some ports to support the events. The ATOM_EVENTS type is added in atomports.h and the compilation of kernel/atomevent.c is added to the Makefiles.
If I may offer some thoughts on this implementation...
Somewhere in my heap of ProjectsIWillTotallyFinishOneDay™ I have an AtomEvent implementation based on an event "object". Receiver threads register with a mask of requested signals and are suspended on a wait queue until a sender triggers the event object with a matching signal. Senders do not know which or how many threads are waiting and receivers do not get touched unless they are currently waiting on a given event. Bit definitions for the signals depend on the event context only and need not be globally unique. I did not submit it because that code tree was already heavily modified to begin with (linked list code replaced with list macros from Linux kernel, whole project run through indent etc.), but if there is interest, I could dig it up again for reference. |
Thanks for your input. Some short notes on my intentions:
The type of events you describe I think it is the type FreeRTOS has. Maybe I should rename this to something else so the name atomevent is still free? [1] To Segger lawyers; I have never read any actual Segger code, it is only deduced from manuals and API code. |
Yes, you are right. My concept of an event has always been a kind of broadcast that anyone interested can receive. Your implementation is more like sending a signal to a single task in a UN*X environment (e.g. kill -USR1 4711). So maybe signal would be a better name for it? |
I have a "FreeRTOS" event cluster workalike for AtomThreads that I wrote a few years back (without reference to the FreeRTOS version), and I didn't call it "event", or even "signal" - I called it "flags". It is not part of my current AtomThreads fork on GitHub because, like @tidklaas, I had changed the base code by running it through the moral-equivalent of "astyle", but also made a number of other changes to "atomkernel.c" that would not work well for many people. |
I have extracted the atomevents updates to a separate branch, else there was other non-relevant stuff. Hence the slightly odd branch name.
What an event is is hopefully documented using doxygen in atomevent.c.
Comments are welcome.