Skip to content

File syn_ao.h

FileList > sched > syn_ao.h

Go to the source code of this file

Active Object (Actor model) framework wrapper. More...

  • #include "../common/syn_defs.h"
  • #include "../pt/syn_pt.h"
  • #include "../sched/syn_mailbox.h"
  • #include "../sched/syn_task.h"
  • #include "../util/syn_fsm.h"

Classes

Type Name
struct SYN_AO_Event
Active Object Event.
struct SYN_ActiveObject
Active Object structure.

Public Functions

Type Name
void syn_ao_init (SYN_ActiveObject * ao, const char * name, const SYN_FSM_Transition * transitions, SYN_FSM_State initial_state, void * mailbox_buf, size_t mailbox_cap)
Initialize an Active Object.
bool syn_ao_post (SYN_ActiveObject * ao, uint16_t sig, void * data)
Post an event to the Active Object's mailbox.

Detailed Description

Combines cooperative tasks, protothreads, mailboxes, and state machines to enforce strict event-driven encapsulation.

Public Functions Documentation

function syn_ao_init

Initialize an Active Object.

void syn_ao_init (
    SYN_ActiveObject * ao,
    const char * name,
    const SYN_FSM_Transition * transitions,
    SYN_FSM_State initial_state,
    void * mailbox_buf,
    size_t mailbox_cap
) 

Parameters:

  • ao Active Object instance.
  • name Name of the active object (used for task/logging).
  • transitions Transition table for the internal state machine.
  • initial_state Initial state of the state machine.
  • mailbox_buf Buffer backing the mailbox event queue.
  • mailbox_cap Capacity (number of elements) of the buffer.

function syn_ao_post

Post an event to the Active Object's mailbox.

bool syn_ao_post (
    SYN_ActiveObject * ao,
    uint16_t sig,
    void * data
) 

Thread-safe and ISR-safe. Protects the mailbox write using critical sections.

Parameters:

  • ao Active Object instance.
  • sig Signal identifier.
  • data Optional payload.

Returns:

true if the event was successfully queued, false if queue is full.



The documentation for this class was generated from the following file src/syntropic/sched/syn_ao.h