From f8c0dc54e36cc201c657aa12e5a22029b092e1bc Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Mon, 13 Jul 2026 21:58:18 +0530 Subject: restructed all the files + uci done now also broke the symbol analyser in the process, i didn't help much, i had to pull out the pen & paper, but it made a cool graph never the less multithreading was a pain! but it got it in the end fixed the structs naming convention, if it's used outside by other files, it's typedeffed, otherwise it's not fixed the recursive imports issued i had in go_args*, where i was casting it to void* in uci to make it work now response.c doesn't deal with ipc, really happy with that change now every single thing has its own responsibility --- src/engine/thread.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/engine/thread.c (limited to 'src/engine/thread.c') diff --git a/src/engine/thread.c b/src/engine/thread.c new file mode 100644 index 0000000..017e9b6 --- /dev/null +++ b/src/engine/thread.c @@ -0,0 +1,34 @@ +#include "engine/threads.h" +#include + +void *engine_thread(void *_args) { + struct thread_args *args = (struct thread_args*)_args; + args->stop = 0; + + int depth = 0; + engine_message_t *message = args->message->newest_valid; + while (true) { + message->depth = depth++; + message->multipv = args->id; + ipc_moves_init(&message->pv); + + // pseudo engine work + for (volatile int k = 0; k < 1000000000; k++) {} + + add_ipc_move(&message->pv, (ipc_move_t) { 14, 24 }); + + if (args->stop || !should_continue(message, args->go_args)) { + message->best_move = (ipc_move_t) { 12, 24 }; + message->ponder = (ipc_move_t) { 42, 54 }; + message->next = NULL; + engine_message_mark_ready(message); + break; + } + + engine_message_mark_ready(message); + message = engine_message_handler_push(args->message); + } + + args->stop = 2; +} + -- cgit v1.2.3