[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r10489 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r10489 - gnunet/src/util |
Date: |
Thu, 4 Mar 2010 15:44:07 +0100 |
Author: nevans
Date: 2010-03-04 15:44:07 +0100 (Thu, 04 Mar 2010)
New Revision: 10489
Modified:
gnunet/src/util/scheduler.c
Log:
execinfo definition
Modified: gnunet/src/util/scheduler.c
===================================================================
--- gnunet/src/util/scheduler.c 2010-03-04 14:42:41 UTC (rev 10488)
+++ gnunet/src/util/scheduler.c 2010-03-04 14:44:07 UTC (rev 10489)
@@ -28,7 +28,13 @@
#include "gnunet_scheduler_lib.h"
#include "gnunet_signal_lib.h"
#include "gnunet_time_lib.h"
+#ifdef LINUX
+#include "execinfo.h"
+#define EXECINFO GNUNET_YES
+#endif
+#define EXECINFO GNUNET_NO
+
#define DEBUG_TASKS GNUNET_NO
/**
@@ -94,6 +100,19 @@
*/
enum GNUNET_SCHEDULER_Priority priority;
+#if EXECINFO
+ /**
+ * Array of strings which make up a backtrace from the point when this
+ * task was scheduled (essentially, who scheduled the task?)
+ */
+ char **backtrace_strings;
+
+ /**
+ * Size of the backtrace_strings array
+ */
+ int num_backtrace_strings;
+#endif
+
};
@@ -438,6 +457,9 @@
GNUNET_NETWORK_fdset_destroy (t->read_set);
if (NULL != t->write_set)
GNUNET_NETWORK_fdset_destroy (t->write_set);
+#ifdef EXECINFO
+ GNUNET_free (t->backtrace_strings);
+#endif
GNUNET_free (t);
}
@@ -749,8 +771,14 @@
enum GNUNET_SCHEDULER_Reason reason)
{
struct Task *t;
-
+#ifdef EXECINFO
+ void *backtrace_array[50];
+#endif
t = GNUNET_malloc (sizeof (struct Task));
+#ifdef EXECINFO
+ t->num_backtrace_strings = backtrace(backtrace_array, 50);
+ t->backtrace_strings = backtrace_symbols(backtrace_array,
t->num_backtrace_strings);
+#endif
t->callback = task;
t->callback_cls = task_cls;
t->id = ++sched->last_id;
@@ -1068,10 +1096,16 @@
GNUNET_SCHEDULER_Task task, void *task_cls)
{
struct Task *t;
-
+#ifdef EXECINFO
+ void *backtrace_array[50];
+#endif
t = GNUNET_malloc (sizeof (struct Task));
t->callback = task;
t->callback_cls = task_cls;
+#ifdef EXECINFO
+ t->num_backtrace_strings = backtrace(backtrace_array, 50);
+ t->backtrace_strings = backtrace_symbols(backtrace_array,
t->num_backtrace_strings);
+#endif
if (rs != NULL)
{
t->read_set = GNUNET_NETWORK_fdset_create ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r10489 - gnunet/src/util,
gnunet <=