feat(async): Optimize resource usage when the async coroutine pattern is not enabled.
This commit is contained in:
@@ -48,8 +48,8 @@ typedef struct mr_async {
|
|||||||
mr_object_t parent;
|
mr_object_t parent;
|
||||||
#if defined(MR_USE_ASYNC_COROUTINE)
|
#if defined(MR_USE_ASYNC_COROUTINE)
|
||||||
mr_await_t await;
|
mr_await_t await;
|
||||||
#endif /* defined(MR_USE_ASYNC_COROUTINE) */
|
|
||||||
mr_int32_t label;
|
mr_int32_t label;
|
||||||
|
#endif /* defined(MR_USE_ASYNC_COROUTINE) */
|
||||||
mr_list_t list;
|
mr_list_t list;
|
||||||
mr_work_t work;
|
mr_work_t work;
|
||||||
mr_ptr_t entry;
|
mr_ptr_t entry;
|
||||||
|
|||||||
@@ -237,10 +237,10 @@ static mr_err_t async_init(mr_async_t *async, const mr_class_t *class,
|
|||||||
mr_work_init(&async->work, async_work_entry, param);
|
mr_work_init(&async->work, async_work_entry, param);
|
||||||
#if defined(MR_USE_ASYNC_COROUTINE)
|
#if defined(MR_USE_ASYNC_COROUTINE)
|
||||||
mr_await_init(&async->await, 1);
|
mr_await_init(&async->await, 1);
|
||||||
|
async->label = 0;
|
||||||
#endif /* defined(MR_USE_ASYNC_COROUTINE) */
|
#endif /* defined(MR_USE_ASYNC_COROUTINE) */
|
||||||
mr_list_init(&async->list);
|
mr_list_init(&async->list);
|
||||||
async->entry = entry;
|
async->entry = entry;
|
||||||
async->label = 0;
|
|
||||||
|
|
||||||
/* Init object */
|
/* Init object */
|
||||||
return mr_object_init((mr_object_t *)async, class);
|
return mr_object_init((mr_object_t *)async, class);
|
||||||
|
|||||||
Reference in New Issue
Block a user