Skip to content
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

Event handling and protection #41

Open
KammutierSpule opened this issue Feb 18, 2024 · 2 comments
Open

Event handling and protection #41

KammutierSpule opened this issue Feb 18, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@KammutierSpule
Copy link

Consider the pseudo code:

Task Dispatch:
{
    sem_wait(&Semaphore);   // Wait for event
    dispatch_event(State_Machines, 1)
}

Task Generate Events:
{
    Machine.Event = SOME_EVENT;
    sem_post(&Semaphore);
    Sleep(random());
}

Task Generate Other Events:
{
    Machine.Event = OTHER_EVENT;
    sem_post(&Semaphore);
    Sleep(random());
}

Should the set of event be protected from other tasks?

  1. Since dispatch_event will clear internally Machine.Event,
  2. Since more than one task can generate events,
  3. Since there is no queue of events, once an event is created, no other can be created until the previous is cleared.

What is your opinion on this? Could this be improved?

@KammutierSpule
Copy link
Author

Regarding 3. this is already explained in the README.md file.

@kiishor
Copy link
Owner

kiishor commented Feb 19, 2024

Hi Mario,
Yes, in the current implementation the state machine handles only one event at a time. This is to keep the implementation as minimal as possible. However, in complex application, this may not be sufficient. The current framework could be improved to support event queue.

I will start working on it soon. I had implemented this feature in the past but it was tightly coupled to my implementation of queue. I don't want to have such dependency in this framework.

Feel free if you also have any suggestion to implement this feature.

@kiishor kiishor added the enhancement New feature or request label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants