#ifndef POOL_TLS_H #define POOL_TLS_H #include #include // Pool size classes (8KB - 52KB) #define POOL_SIZE_CLASSES 7 extern const size_t POOL_CLASS_SIZES[POOL_SIZE_CLASSES]; // Public API (Box 1) void* pool_alloc(size_t size); void pool_free(void* ptr); void pool_thread_init(void); void pool_thread_cleanup(void); // Pre-warm TLS cache (Phase 1.5b - call once at thread init) void pool_tls_prewarm(void); // Internal API (for Box 2 only) void pool_install_chain(int class_idx, void* chain, int count); int pool_get_refill_count(int class_idx); // Remote queue (cross-thread free) API — Phase 1.5c int pool_remote_push(int class_idx, void* ptr, int owner_tid); int pool_remote_drain_light(int class_idx); // Feature flags #define POOL_USE_HEADERS 1 // 1-byte headers for O(1) free #if POOL_USE_HEADERS #define POOL_MAGIC 0xb0 // Different from Tiny (0xa0) for safety #define POOL_HEADER_SIZE 1 #endif #endif // POOL_TLS_H