Module: kamailio
Branch: master
Commit: 546639ba55e8d0e3116d4d2bb1999d7a44f6fe69
URL:
https://github.com/kamailio/kamailio/commit/546639ba55e8d0e3116d4d2bb1999d7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-02-14T15:17:11+01:00
core: async task - keep group structure as global for own processes
---
Modified: src/core/async_task.c
Modified: src/core/async_task.h
---
Diff:
https://github.com/kamailio/kamailio/commit/546639ba55e8d0e3116d4d2bb1999d7…
Patch:
https://github.com/kamailio/kamailio/commit/546639ba55e8d0e3116d4d2bb1999d7…
---
diff --git a/src/core/async_task.c b/src/core/async_task.c
index b64e071a11..a96eb90286 100644
--- a/src/core/async_task.c
+++ b/src/core/async_task.c
@@ -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);
@@ -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;
+}
+
/**
*
*/
@@ -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],
diff --git a/src/core/async_task.h b/src/core/async_task.h
index 6539f7f92e..4f6a3598b1 100644
--- a/src/core/async_task.h
+++ b/src/core/async_task.h
@@ -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);