2017-05-24 11:04:19 +00:00
|
|
|
#ifndef MM_MACHINE_MGR_H
|
|
|
|
#define MM_MACHINE_MGR_H
|
2017-05-18 09:50:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* machinarium.
|
|
|
|
*
|
|
|
|
* cooperative multitasking engine.
|
2020-04-02 11:00:56 +00:00
|
|
|
*/
|
2017-05-18 09:50:28 +00:00
|
|
|
|
2017-05-24 11:04:19 +00:00
|
|
|
typedef struct mm_machinemgr mm_machinemgr_t;
|
2017-05-18 09:50:28 +00:00
|
|
|
|
2020-12-28 10:43:31 +00:00
|
|
|
struct mm_machinemgr {
|
2017-05-18 09:50:28 +00:00
|
|
|
pthread_spinlock_t lock;
|
2020-04-02 11:00:56 +00:00
|
|
|
mm_list_t list;
|
|
|
|
int count;
|
|
|
|
uint64_t seq;
|
2017-05-18 09:50:28 +00:00
|
|
|
};
|
|
|
|
|
2020-12-28 10:43:31 +00:00
|
|
|
void mm_machinemgr_init(mm_machinemgr_t *);
|
|
|
|
void mm_machinemgr_free(mm_machinemgr_t *);
|
|
|
|
int mm_machinemgr_count(mm_machinemgr_t *);
|
|
|
|
void mm_machinemgr_add(mm_machinemgr_t *, mm_machine_t *);
|
|
|
|
void mm_machinemgr_delete(mm_machinemgr_t *, mm_machine_t *);
|
|
|
|
mm_machine_t *mm_machinemgr_delete_by_id(mm_machinemgr_t *, uint64_t);
|
|
|
|
mm_machine_t *mm_machinemgr_find_by_id(mm_machinemgr_t *, uint64_t);
|
2017-05-18 09:50:28 +00:00
|
|
|
|
2017-05-24 11:04:19 +00:00
|
|
|
#endif /* MM_MACHINE_MGR_H */
|