summaryrefslogtreecommitdiff
path: root/include/engine/threads.h
diff options
context:
space:
mode:
authorAargh Rai <aargh.rai+git@gmail.com>2026-08-23 16:06:42 +0530
committerAargh Rai <aargh.rai+git@gmail.com>2026-08-23 16:06:42 +0530
commit99de764d1d1b936594643e34ae4d2c4a239f69db (patch)
treef45884164774e760e9ae37d3c37ccfe80dbbc836 /include/engine/threads.h
parent54afeb6dd89fffae92274cb6fe2e9a86fd57c6e3 (diff)
phase C, D & E
Diffstat (limited to 'include/engine/threads.h')
-rw-r--r--include/engine/threads.h16
1 files changed, 15 insertions, 1 deletions
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);