summaryrefslogtreecommitdiff
path: root/tests/dlt-test-preregister-context.c
diff options
context:
space:
mode:
authorStefan Vacek <stefan.vacek@intel.com>2015-08-28 14:28:32 +0200
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2015-10-07 10:35:57 +0200
commitcd35815e6870df9b8db0da807c4d4db3607539ba (patch)
treeac5c80d237b400638dce392e08c1cc5944214f0b /tests/dlt-test-preregister-context.c
parentc3b53f8805236cb7c72eb62ef04866f34de33103 (diff)
downloadDLT-daemon-cd35815e6870df9b8db0da807c4d4db3607539ba.tar.gz
Allow registration of contexts before application is registered
Signed-off-by: Stefan Vacek <stefan.vacek@intel.com>
Diffstat (limited to 'tests/dlt-test-preregister-context.c')
-rw-r--r--tests/dlt-test-preregister-context.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/dlt-test-preregister-context.c b/tests/dlt-test-preregister-context.c
new file mode 100644
index 0000000..ad10d6f
--- /dev/null
+++ b/tests/dlt-test-preregister-context.c
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2015 Intel Corporation
+ *
+ */
+
+#include <unistd.h> /* for fork() */
+
+#include "dlt.h"
+
+/**
+ * @brief sample code for using pre-registered contexts
+ */
+int main()
+{
+ DltContext mainContext;
+ DLT_REGISTER_CONTEXT(mainContext, "CTXP", "main context");
+
+ DLT_LOG(mainContext, DLT_LOG_WARN, DLT_STRING("First message before app registered"));
+ usleep(200000);
+
+ DLT_LOG(mainContext, DLT_LOG_WARN, DLT_STRING("Second message before app registered"));
+ usleep(200000);
+
+ DLT_REGISTER_APP("PRNT", "Sample pre-register application");
+
+ DLT_LOG(mainContext, DLT_LOG_WARN, DLT_STRING("First message after app registered"));
+ usleep(200000);
+
+ DLT_UNREGISTER_APP();
+
+ return 0;
+}