summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Rapp <tobias.rapp@student.kit.edu>2013-07-01 12:42:11 +0200
committerTobias Rapp <tobias.rapp@student.kit.edu>2013-07-01 12:42:11 +0200
commit0ef14b68f22b63b81055b6d2240c4c170fbbeab3 (patch)
tree4058d7c029b86303571e5d37946bf357831feba1
parent506b9667e2770273760607971680949401086f18 (diff)
Added an option for debug output
-rw-r--r--octopos_threads.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/octopos_threads.c b/octopos_threads.c
index 077dfe9..c8a20fc 100644
--- a/octopos_threads.c
+++ b/octopos_threads.c
@@ -13,6 +13,18 @@
#if defined(GC_OCTOPOS_THREADS)
+// For debug output
+#define OCTOPOS_DEBUG
+
+
+#if defined(OCTOPOS_DEBUG)
+# include <stdio.h>
+# define OCTO_LOG(...) printf ( __VA_ARGS__ )
+#else
+# define OCTO_LOG(...)
+#endif
+
+
/* Allocation lock declarations. */
GC_INNER simple_spinlock GC_allocate_ml;
@@ -21,19 +33,25 @@ GC_INNER simple_spinlock GC_allocate_ml;
GC_INNER void GC_stop_world(void)
{
- gc_stop_world(); /* OctoPOS stop world */
+ OCTO_LOG("Calling stop world\n");
+ int res = gc_stop_world(); /* OctoPOS stop world */
+ OCTO_LOG("Stop world returned %i\n", res);
}
GC_INNER void GC_start_world(void)
{
- gc_start_world(); /* OctoPOS start world */
+ OCTO_LOG("Calling start world\n");
+ int res = gc_start_world(); /* OctoPOS start world */
+ OCTO_LOG("Start world returned %i\n", res);
}
/* Push all thread stacks */
GC_INNER void GC_push_all_stacks(void)
{
+ OCTO_LOG("Calling push all stacks\n");
+
/* Call OctoPOS to push all stacks */
- gc_push_all_stacks((void (*)(const void*, const void*)) &GC_push_all_stack);
+ GC_ASSERT(gc_iterate_all_stacks((void (*)(const void*, const void*)) &GC_push_all_stack));
}
/* Wrapper for functions that are likely to block for an appreciable
@@ -66,5 +84,4 @@ GC_INNER unsigned char *GC_check_finalizer_nested(void)
return NULL; //TODO
}
-
#endif /* GC_OCTOPOS_THREADS */