diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-07-13 21:58:18 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-07-13 21:58:18 +0530 |
| commit | f8c0dc54e36cc201c657aa12e5a22029b092e1bc (patch) | |
| tree | a0dd1a42c9681be98a7508c128db0dacacefc2e7 /src/engine/thread.c | |
| parent | 2e8b78ab0ef01eaacd8094ff839ac93b4451e9c3 (diff) | |
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
Diffstat (limited to 'src/engine/thread.c')
| -rw-r--r-- | src/engine/thread.c | 34 |
1 files changed, 34 insertions, 0 deletions
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 <stdio.h> + +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; +} + |
