summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorMichael Scott <michael.scott@linaro.org>2017-01-23 13:12:10 -0800
committerJukka Rissanen <jukka.rissanen@linux.intel.com>2017-02-03 15:59:15 +0200
commited7ea9924434884d98384232159021fa0893fe2b (patch)
tree87fa771edda8dba62cae2a738d00f5b2a622e2dd /samples
parent2bcd700462a0da2ae52825b6f9914d62be333192 (diff)
samples: net: irc_bot: run sample process as a thread
This allows for a set app stack and threaded functions to be used later. Change-Id: I647a3defdf6eb4cca2a4a21192b20641f5bf8d4a Signed-off-by: Michael Scott <michael.scott@linaro.org>
Diffstat (limited to 'samples')
-rw-r--r--samples/net/irc_bot/src/irc-bot.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/samples/net/irc_bot/src/irc-bot.c b/samples/net/irc_bot/src/irc-bot.c
index 89f1562b3..3abb56f81 100644
--- a/samples/net/irc_bot/src/irc-bot.c
+++ b/samples/net/irc_bot/src/irc-bot.c
@@ -31,6 +31,9 @@
#include <stdio.h>
#include <zephyr.h>
+#define STACK_SIZE 2048
+uint8_t stack[STACK_SIZE];
+
/* LED */
#if defined(LED0_GPIO_PORT)
#define LED_GPIO_NAME LED0_GPIO_PORT
@@ -718,7 +721,7 @@ initialize_hardware(void)
}
}
-void main(void)
+static void irc_bot(void)
{
struct zirc irc = { };
struct zirc_chan chan = { };
@@ -733,3 +736,9 @@ void main(void)
panic("Could not connect");
}
}
+
+void main(void)
+{
+ k_thread_spawn(stack, STACK_SIZE, (k_thread_entry_t)irc_bot,
+ NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
+}