Fix drain box compilation: Use pthread_self() directly
Issue: - tiny_self_u32() is static inline, cannot be linked from drain box - Link error: undefined reference to 'tiny_self_u32' Fix: - Use pthread_self() directly like hakmem_tiny_superslab.c:917 - Added <pthread.h> include - Changed extern declaration from size_t to const size_t 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -24,6 +24,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
#include "tls_sll_box.h" // TLS SLL operations (tls_sll_pop)
|
||||
#include "../hakmem_tiny_config.h" // TINY_NUM_CLASSES
|
||||
#include "../hakmem_super_registry.h" // SuperSlab lookup
|
||||
@ -128,11 +129,11 @@ static inline uint32_t tiny_tls_sll_drain(int class_idx, uint32_t batch_size) {
|
||||
|
||||
// External functions needed for drain
|
||||
extern SuperSlab* hak_super_lookup(void* ptr); // SuperSlab registry lookup
|
||||
extern uint32_t tiny_self_u32(void); // Thread ID (from tiny_superslab_free.inc.h:127)
|
||||
extern size_t g_tiny_class_sizes[TINY_NUM_CLASSES]; // Block sizes
|
||||
extern const size_t g_tiny_class_sizes[TINY_NUM_CLASSES]; // Block sizes (const)
|
||||
|
||||
// Get thread ID once (used for all blocks)
|
||||
uint32_t my_tid = tiny_self_u32();
|
||||
// Note: Use pthread_self() directly since tiny_self_u32() is static inline
|
||||
uint32_t my_tid = (uint32_t)(uintptr_t)pthread_self();
|
||||
|
||||
// Drain loop: Pop blocks from TLS SLL and push to slab freelist
|
||||
for (uint32_t i = 0; i < to_drain; i++) {
|
||||
|
||||
9
hakmem.d
9
hakmem.d
@ -28,8 +28,10 @@ hakmem.o: core/hakmem.c core/hakmem.h core/hakmem_build_flags.h \
|
||||
core/box/../box/../tiny_region_id.h \
|
||||
core/box/../box/../hakmem_tiny_integrity.h \
|
||||
core/box/../box/../hakmem_tiny.h core/box/../box/../ptr_track.h \
|
||||
core/box/../box/../tiny_debug_ring.h core/box/../hakmem_tiny_integrity.h \
|
||||
core/box/front_gate_classifier.h core/box/hak_wrappers.inc.h
|
||||
core/box/../box/../tiny_debug_ring.h core/box/../box/tls_sll_drain_box.h \
|
||||
core/box/../box/tls_sll_box.h core/box/../box/free_local_box.h \
|
||||
core/box/../hakmem_tiny_integrity.h core/box/front_gate_classifier.h \
|
||||
core/box/hak_wrappers.inc.h
|
||||
core/hakmem.h:
|
||||
core/hakmem_build_flags.h:
|
||||
core/hakmem_config.h:
|
||||
@ -96,6 +98,9 @@ core/box/../box/../hakmem_tiny_integrity.h:
|
||||
core/box/../box/../hakmem_tiny.h:
|
||||
core/box/../box/../ptr_track.h:
|
||||
core/box/../box/../tiny_debug_ring.h:
|
||||
core/box/../box/tls_sll_drain_box.h:
|
||||
core/box/../box/tls_sll_box.h:
|
||||
core/box/../box/free_local_box.h:
|
||||
core/box/../hakmem_tiny_integrity.h:
|
||||
core/box/front_gate_classifier.h:
|
||||
core/box/hak_wrappers.inc.h:
|
||||
|
||||
Reference in New Issue
Block a user