|
@@ -46,6 +46,7 @@
|
|
|
|
|
|
static int _async_task_workers = 0;
|
|
|
static int _async_task_sockets[2];
|
|
|
+static int _async_task_usleep = 0;
|
|
|
|
|
|
int async_task_run(int idx);
|
|
|
|
|
@@ -174,6 +175,19 @@ int async_task_set_workers(int n)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ *
|
|
|
+ */
|
|
|
+int async_task_set_usleep(int n)
|
|
|
+{
|
|
|
+ int v;
|
|
|
+
|
|
|
+ v = _async_task_usleep;
|
|
|
+ _async_task_usleep = n;
|
|
|
+
|
|
|
+ return v;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
*/
|
|
@@ -204,6 +218,7 @@ int async_task_run(int idx)
|
|
|
LM_DBG("async task worker %d ready\n", idx);
|
|
|
|
|
|
for( ; ; ) {
|
|
|
+ if(unlikely(_async_task_usleep)) sleep_us(_async_task_usleep);
|
|
|
if ((received = recvfrom(_async_task_sockets[0],
|
|
|
&ptask, sizeof(async_task_t*),
|
|
|
0, NULL, 0)) < 0) {
|