Skip to content

Commit

Permalink
core: async task - keep group structure as global for own processes
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Feb 14, 2022
1 parent 5b4506b commit 546639b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core/async_task.c
Expand Up @@ -46,6 +46,7 @@
#include "async_task.h"

static async_wgroup_t *_async_wgroup_list = NULL;
static async_wgroup_t *_async_wgroup_crt = NULL;

int async_task_run(async_wgroup_t *awg, int idx);

Expand All @@ -68,6 +69,14 @@ int async_task_workers_active(void)
return 1;
}

/**
*
*/
async_wgroup_t *async_task_workers_get_crt(void)
{
return _async_wgroup_crt;
}

/**
*
*/
Expand Down Expand Up @@ -446,6 +455,8 @@ int async_task_run(async_wgroup_t *awg, int idx)
LM_DBG("async task worker [%.*s] idx [%d] ready\n", awg->name.len,
awg->name.s, idx);

_async_wgroup_crt = awg;

for( ; ; ) {
if(unlikely(awg->usleep)) sleep_us(awg->usleep);
if ((received = recvfrom(awg->sockets[0],
Expand Down
1 change: 1 addition & 0 deletions src/core/async_task.h
Expand Up @@ -50,6 +50,7 @@ int async_task_push(async_task_t *task);
int async_task_set_usleep(int n);
int async_task_workers_get(void);
int async_task_workers_active(void);
async_wgroup_t *async_task_workers_get_crt(void);

int async_task_group_push(str *gname, async_task_t *task);

Expand Down

0 comments on commit 546639b

Please sign in to comment.