From 0f066befeb87e670898bf032f51d6dd587feb75a Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Wed, 23 Oct 2013 22:13:53 +0200 Subject: [PATCH 1/2] use CREATE_WOUT_YIELD on uart0 thread creation This should remove a race condition in the case that some uart event occurs after the uart0 thread has started and before control has returned to the calling thread, as uart0_handler_pid would not have been set yet. --- sys/uart0/uart0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/uart0/uart0.c b/sys/uart0/uart0.c index 56dc5875a1..450572ca96 100644 --- a/sys/uart0/uart0.c +++ b/sys/uart0/uart0.c @@ -25,7 +25,7 @@ static void uart0_loop(void) void board_uart0_init(void) { ringbuffer_init(&uart0_ringbuffer, buffer, UART0_BUFSIZE); - int pid = thread_create(uart0_thread_stack, sizeof(uart0_thread_stack), PRIORITY_MAIN - 1, CREATE_STACKTEST, uart0_loop, "uart0"); + int pid = thread_create(uart0_thread_stack, sizeof(uart0_thread_stack), PRIORITY_MAIN - 1, CREATE_STACKTEST|CREATE_WOUT_YIELD, uart0_loop, "uart0"); uart0_handler_pid = pid; puts("uart0_init() [OK]"); } From 05987cb6db3f7ab704d7539ac9a3f894dd3908d2 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Wed, 23 Oct 2013 22:46:18 +0200 Subject: [PATCH 2/2] break long line --- sys/uart0/uart0.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/uart0/uart0.c b/sys/uart0/uart0.c index 450572ca96..e53af73df9 100644 --- a/sys/uart0/uart0.c +++ b/sys/uart0/uart0.c @@ -25,7 +25,14 @@ static void uart0_loop(void) void board_uart0_init(void) { ringbuffer_init(&uart0_ringbuffer, buffer, UART0_BUFSIZE); - int pid = thread_create(uart0_thread_stack, sizeof(uart0_thread_stack), PRIORITY_MAIN - 1, CREATE_STACKTEST|CREATE_WOUT_YIELD, uart0_loop, "uart0"); + int pid = thread_create( + uart0_thread_stack, + sizeof(uart0_thread_stack), + PRIORITY_MAIN - 1, + CREATE_STACKTEST|CREATE_WOUT_YIELD, + uart0_loop, + "uart0" + ); uart0_handler_pid = pid; puts("uart0_init() [OK]"); }