Skip to content

Event handling and protection #41

Open
@KammutierSpule

Description

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?

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions