[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r9449 - in gnunet/src: include topology util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r9449 - in gnunet/src: include topology util |
Date: |
Tue, 10 Nov 2009 12:45:42 -0700 |
Author: grothoff
Date: 2009-11-10 12:45:42 -0700 (Tue, 10 Nov 2009)
New Revision: 9449
Modified:
gnunet/src/include/gnunet_scheduler_lib.h
gnunet/src/topology/
gnunet/src/util/scheduler.c
Log:
allow any function in a task to easily get the reason code
Modified: gnunet/src/include/gnunet_scheduler_lib.h
===================================================================
--- gnunet/src/include/gnunet_scheduler_lib.h 2009-11-10 08:54:05 UTC (rev
9448)
+++ gnunet/src/include/gnunet_scheduler_lib.h 2009-11-10 19:45:42 UTC (rev
9449)
@@ -242,6 +242,18 @@
/**
+ * Obtain the reason code for why the current task was
+ * started. Will return the same value as
+ * the GNUNET_SCHEDULER_TaskContext's reason field.
+ *
+ * @param sched scheduler to query
+ * @return reason(s) why the current task is run
+ */
+enum GNUNET_SCHEDULER_Reason
+GNUNET_SCHEDULER_get_reason (struct GNUNET_SCHEDULER_Handle *sched);
+
+
+/**
* Cancel the task with the specified identifier.
* The task must not yet have run.
*
Property changes on: gnunet/src/topology
___________________________________________________________________
Modified: svn:ignore
- test_gnunet_service_topology.gcno
test_gnunet_service_topology.gcda
gnunet-daemon-topology.gcda
Makefile.in
Makefile
gnunet-daemon-topology.gcno
gnunet-daemon-topology
.deps
+ test_gnunet_service_topology
test_gnunet_service_topology.gcno
test_gnunet_service_topology.gcda
gnunet-daemon-topology.gcda
Makefile.in
Makefile
gnunet-daemon-topology.gcno
gnunet-daemon-topology
.deps
Modified: gnunet/src/util/scheduler.c
===================================================================
--- gnunet/src/util/scheduler.c 2009-11-10 08:54:05 UTC (rev 9448)
+++ gnunet/src/util/scheduler.c 2009-11-10 19:45:42 UTC (rev 9449)
@@ -110,6 +110,11 @@
struct Task *pending;
/**
+ * ID of the task that is running right now.
+ */
+ struct Task *active_task;
+
+ /**
* List of tasks ready to run right now,
* grouped by importance.
*/
@@ -456,6 +461,7 @@
sched->ready_count--;
sched->current_priority = p;
GNUNET_assert (pos->priority == p);
+ sched->active_task = pos;
tc.sched = sched;
tc.reason = pos->reason;
tc.read_ready = pos->read_set;
@@ -465,6 +471,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Running task: %llu / %p\n", pos->id, pos->callback_cls);
#endif
+ sched->active_task = NULL;
destroy_task (pos);
sched->tasks_run++;
}
@@ -601,7 +608,21 @@
}
+/**
+ * Obtain the reason code for why the current task was
+ * started. Will return the same value as
+ * the GNUNET_SCHEDULER_TaskContext's reason field.
+ *
+ * @param sched scheduler to query
+ * @return reason(s) why the current task is run
+ */
+enum GNUNET_SCHEDULER_Reason
+GNUNET_SCHEDULER_get_reason (struct GNUNET_SCHEDULER_Handle *sched)
+{
+ return sched->active_task->reason;
+}
+
/**
* Get information about the current load of this scheduler. Use this
* function to determine if an elective task should be added or simply
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r9449 - in gnunet/src: include topology util,
gnunet <=