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 /include/ipc/engine_message.h | |
| 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 'include/ipc/engine_message.h')
| -rw-r--r-- | include/ipc/engine_message.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/include/ipc/engine_message.h b/include/ipc/engine_message.h new file mode 100644 index 0000000..a651bc2 --- /dev/null +++ b/include/ipc/engine_message.h @@ -0,0 +1,67 @@ +#ifndef ENGINE_MESSAGE_H +#define ENGINE_MESSAGE_H + +#include "ipc/moves.h" +#include <stdatomic.h> + +typedef struct engine_message { + atomic_int ready; + + int depth; + int seldepth; + int multipv; + int score_cp; + int nodes; + int nps; + int hashfull; + int tbhits; + int time; + + int mate; + bool node_limit; + ipc_moves_t pv; + + ipc_move_t best_move; + ipc_move_t ponder; + + struct engine_message *next; +} engine_message_t; + +typedef struct { + engine_message_t *oldest_valid; + engine_message_t *newest_valid; + int count; + + // mainly for debugging purposes + int popped_count; + int pushed_count; + +} engine_message_handler_t; + +typedef struct { + engine_message_handler_t **data; + int count; + int capacity; +} engine_messages_t; + +void engine_message_handler_init(engine_message_handler_t *handle); +void engine_message_handler_acquire(engine_message_handler_t *handle); +void engine_message_handler_release(engine_message_handler_t *handle); +bool engine_message_handler_can_pop(engine_message_handler_t *handle); +engine_message_t *engine_message_handler_pop( + engine_message_handler_t *handle +); +engine_message_t *engine_message_handler_push( + engine_message_handler_t *handle +); + +void engine_messages_init(engine_messages_t *messages); +void engine_messages_deinit(engine_messages_t *messages); + +void engine_message_init(engine_message_t *message); +void engine_messages_refresh(engine_messages_t *messages); +void engine_message_mark_ready(engine_message_t *message); +bool engine_message_is_ready(engine_message_t *message); +void engine_message_deinit(engine_message_t *message); + +#endif // ENGINE_MESSAGE_H |
