From 99de764d1d1b936594643e34ae4d2c4a239f69db Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Sun, 23 Aug 2026 16:06:42 +0530 Subject: phase C, D & E --- include/engine/threads.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'include/engine') diff --git a/include/engine/threads.h b/include/engine/threads.h index da221a8..43c4459 100644 --- a/include/engine/threads.h +++ b/include/engine/threads.h @@ -21,6 +21,7 @@ typedef struct split_point { struct split_point *parent; int ply; + int depth; // remaining search depth at this node int node_type; int confidence; position_t position_snapshot; @@ -39,7 +40,8 @@ struct child_thread_args { position_t *position; ttable_t *ttable; - int sp_stack; + split_point_t *split_points; // shared DTS pool (§2.4) + size_t sp_pool_capacity; engine_message_handler_t *message; }; struct root_thread_args { @@ -82,6 +84,18 @@ void __threads_args_init( struct threads *handler, int i ); + +// DTS primitives (§2.3–2.8): split point pool + lock-free move claiming +split_point_t *split_point_alloc(struct threads *handler); +void split_point_free(struct threads *handler, split_point_t *split_point); +void split_point_publish(split_point_t *split_point); +bool split_point_claim_move(split_point_t *split_point, move_t *move); +bool split_point_merge(split_point_t *split_point); +void split_point_share(split_point_t *split_point, i32 score, move_t move); + +// HELP (§2.3): scan the pool for a published split point with work left +split_point_t *threads_find_work(struct threads *handler); +split_point_t *__pool_find_work(split_point_t *pool, size_t capacity); #endif void threads_init(struct threads *handler, size_t capacity); void threads_deinit(struct threads *handler); -- cgit v1.2.3