2017-03-21 09:47:32 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* machinarium.
|
2017-03-21 09:58:58 +00:00
|
|
|
*
|
2017-03-21 09:47:32 +00:00
|
|
|
* cooperative multitasking engine.
|
|
|
|
*/
|
|
|
|
|
2017-03-21 12:55:23 +00:00
|
|
|
#include <machinarium.h>
|
2017-05-17 14:20:04 +00:00
|
|
|
#include <machinarium_private.h>
|
|
|
|
|
2017-05-18 09:50:28 +00:00
|
|
|
mm_t machinarium;
|
2017-03-21 09:47:32 +00:00
|
|
|
|
2017-03-24 13:50:23 +00:00
|
|
|
MACHINE_API int
|
|
|
|
machinarium_init(void)
|
|
|
|
{
|
2017-05-18 09:50:28 +00:00
|
|
|
mm_machinemgr_init(&machinarium.machine_mgr);
|
2017-05-19 11:17:58 +00:00
|
|
|
mm_msgpool_init(&machinarium.msg_pool);
|
2017-05-23 18:47:28 +00:00
|
|
|
mm_tls_init();
|
2017-05-23 12:34:35 +00:00
|
|
|
mm_taskmgr_init(&machinarium.task_mgr);
|
|
|
|
mm_taskmgr_start(&machinarium.task_mgr, 3);
|
2017-03-28 11:51:57 +00:00
|
|
|
return 0;
|
2017-03-24 13:50:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_API void
|
|
|
|
machinarium_free(void)
|
2017-05-17 14:20:04 +00:00
|
|
|
{
|
2017-05-23 12:34:35 +00:00
|
|
|
mm_taskmgr_stop(&machinarium.task_mgr);
|
2017-05-18 09:50:28 +00:00
|
|
|
mm_machinemgr_free(&machinarium.machine_mgr);
|
2017-05-19 11:17:58 +00:00
|
|
|
mm_msgpool_free(&machinarium.msg_pool);
|
2017-05-19 12:07:38 +00:00
|
|
|
mm_tls_free();
|
2017-05-17 14:20:04 +00:00
|
|
|
}
|