From 575d8e2167217d945cffd0c32c4f73f46fecea69 Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Fri, 7 Apr 2023 19:56:54 +0000 Subject: [PATCH] creole --- creole | 2 +- software/src/main.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/creole b/creole index 0ead095..56c6523 160000 --- a/creole +++ b/creole @@ -1 +1 @@ -Subproject commit 0ead095044c93825c7db8cec0a6b92769bac7a7d +Subproject commit 56c6523e15176ecb5eadeda803d7e54c165d69ca diff --git a/software/src/main.c b/software/src/main.c index d27f418..a49e52c 100644 --- a/software/src/main.c +++ b/software/src/main.c @@ -126,18 +126,18 @@ read_size(int s) } static void -exec_entry(void *client_p, void *threadnum_p, +exec_entry(void *client_p, void *connection_num_p, void *unused __attribute__((unused))) { intptr_t client = (intptr_t)client_p; - intptr_t threadnum = (intptr_t)threadnum_p; - LOG_DBG("Entered thread %d", (int)threadnum); - int size = read_size(client); - + intptr_t connection_num = (intptr_t)connection_num_p; char thread_name[64]; - snprintk(thread_name, sizeof(thread_name), "%"PRIdPTR":%"PRIdPTR, client, threadnum); + snprintk(thread_name, sizeof(thread_name), "%"PRIdPTR":%"PRIdPTR, client, connection_num); k_thread_name_set(k_current_get(), thread_name); + LOG_DBG("%s: entered thread", get_thread_name()); + + int size = read_size(client); if (size < 0) { LOG_WRN("%s: error in read size: %d", get_thread_name(), size); zsock_close(client); @@ -154,6 +154,7 @@ exec_entry(void *client_p, void *threadnum_p, exec_creole(readbuf[threadnum], size, (int)client); zsock_close(client); + LOG_INF("Exiting thread %s", get_thread_name()); } /* TODO: main thread must be higher priority than execution threads */ @@ -172,9 +173,8 @@ main_loop(int srvsock) thread_ever_used[i] = true; k_thread_create(&threads[i], stacks[i], THREAD_STACK_SIZ, exec_entry, - (void*) client, (void*) i, - (void*) connection_counter, - 1, 0, K_NO_WAIT); + (void*) client, (void*) connection_counter, + NULL, 1, 0, K_NO_WAIT); break; } }