Skip to content

File syn_ao.h

File List > sched > syn_ao.h

Go to the documentation of this file

#ifndef SYN_AO_H
#define SYN_AO_H

#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"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
    uint16_t sig; 
    void *data;   
} SYN_AO_Event;

typedef struct {
    SYN_Task task;       
    SYN_PT pt;           
    SYN_Mailbox mailbox; 
    SYN_FSM fsm;         
    SYN_AO_Event
        last_event; 
} SYN_ActiveObject;

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);

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

#ifdef __cplusplus
}
#endif

#endif /* SYN_AO_H */