[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: speed up running of tasks via GNUNTE_SCH
From: |
gnunet |
Subject: |
[gnunet] branch master updated: speed up running of tasks via GNUNTE_SCHEDULER_add_now() by a factor of at least 5 |
Date: |
Tue, 04 Feb 2020 19:00:02 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new f40520b09 speed up running of tasks via GNUNTE_SCHEDULER_add_now() by
a factor of at least 5
f40520b09 is described below
commit f40520b094620f160a582af8810bfba7da61004b
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Feb 4 18:56:17 2020 +0100
speed up running of tasks via GNUNTE_SCHEDULER_add_now() by a factor of at
least 5
---
src/util/scheduler.c | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index 48a3f04ce..4be690d44 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -719,9 +719,11 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task,
{
struct GNUNET_SCHEDULER_Handle *sh;
struct GNUNET_SCHEDULER_Driver *driver;
- struct DriverContext context = { .scheduled_head = NULL,
- .scheduled_tail = NULL,
- .timeout = GNUNET_TIME_absolute_get () };
+ struct DriverContext context = {
+ .scheduled_head = NULL,
+ .scheduled_tail = NULL,
+ .timeout = GNUNET_TIME_absolute_get ()
+ };
driver = GNUNET_SCHEDULER_driver_select ();
driver->cls = &context;
@@ -1280,9 +1282,24 @@ struct GNUNET_SCHEDULER_Task *
GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_TaskCallback task,
void *task_cls)
{
- return GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_ZERO,
- task,
- task_cls);
+ struct GNUNET_SCHEDULER_Task *t;
+
+ t = GNUNET_new (struct GNUNET_SCHEDULER_Task);
+ GNUNET_async_scope_get (&t->scope);
+ t->callback = task;
+ t->callback_cls = task_cls;
+ t->read_fd = -1;
+ t->write_fd = -1;
+#if PROFILE_DELAYS
+ t->start_time = GNUNET_TIME_absolute_get ();
+#endif
+ t->timeout = GNUNET_TIME_UNIT_ZERO_ABS;
+ t->priority = current_priority;
+ t->on_shutdown = GNUNET_YES;
+ t->lifeness = current_lifeness;
+ queue_ready_task (t);
+ init_backtrace (t);
+ return t;
}
@@ -2290,6 +2307,8 @@ select_loop (struct GNUNET_SCHEDULER_Handle *sh,
(GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
context->timeout.abs_value_us))
{
+ struct GNUNET_TIME_Relative time_remaining;
+
LOG (GNUNET_ERROR_TYPE_DEBUG,
"select timeout = %s\n",
GNUNET_STRINGS_absolute_time_to_string (context->timeout));
@@ -2310,8 +2329,9 @@ select_loop (struct GNUNET_SCHEDULER_Handle *sh,
GNUNET_NETWORK_fdset_set_native (ws, pos->fdi->sock);
}
}
- struct GNUNET_TIME_Relative time_remaining =
- GNUNET_TIME_absolute_get_remaining (context->timeout);
+ time_remaining = GNUNET_TIME_absolute_get_remaining (context->timeout);
+ if (0 < ready_count)
+ time_remaining = GNUNET_TIME_UNIT_ZERO;
if (NULL == scheduler_select)
{
select_result = GNUNET_NETWORK_socket_select (rs,
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: speed up running of tasks via GNUNTE_SCHEDULER_add_now() by a factor of at least 5,
gnunet <=