aboutsummaryrefslogtreecommitdiff
path: root/src/zjs_common.h
diff options
context:
space:
mode:
authorGeoff Gustafson <geoff@linux.intel.com>2017-09-08 16:50:02 -0700
committerGeoff Gustafson <geoff@linux.intel.com>2017-09-11 16:13:23 -0700
commit85059f0137518c4a3404618d394d9d4b99a16489 (patch)
tree36b6db845f41e104cddac789dd312031ab9f3b15 /src/zjs_common.h
parent97e29758f0551370dd6e1af83183d50ec832f51d (diff)
[callbacks] Split callback locks to protect ringbuf vs. cb_map
Way too much code was being locked in zjs_callbacks.c and it was causing deadlocks. It's still probably possible, this could be refined further - for example jerry_call_function is still getting called within a CB_LOCK. Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
Diffstat (limited to 'src/zjs_common.h')
-rw-r--r--src/zjs_common.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/zjs_common.h b/src/zjs_common.h
index 0a7f574..9f5ae35 100644
--- a/src/zjs_common.h
+++ b/src/zjs_common.h
@@ -94,6 +94,17 @@ int zjs_get_ms(void);
#define FTRACE_JSAPI do {} while (0)
#endif
+/**
+ * print function that works only if DEBUG_LOCKS is defined
+ */
+#ifdef DEBUG_LOCKS
+#define LPRINT(str) \
+ ZJS_PRINT("[%x] %s: %s\n", (u32_t)k_current_get() & 0xffff, \
+ __func__, str)
+#else
+#define LPRINT(str) do {} while (0)
+#endif
+
// TODO: We should instead have a macro that changes in debug vs. release build,
// to save string space and instead print error codes or something for release.