Replacing Malloc and strdup in scan helper function with FileEntry and path arenas

This commit is contained in:
2026-03-11 16:17:22 +01:00
parent aef070192f
commit 0e3ec5b09c
4 changed files with 189 additions and 118 deletions

View File

@@ -45,23 +45,6 @@ static double timer_stop(HiResTimer *t) {
(double)g_qpc_freq.QuadPart;
}
// MPMC Queue
static MPMCQueue g_dir_queue;
static MPMCQueue g_file_queue;
typedef struct {
mem_arena *path_arena;
mem_arena *meta_arena;
MPMCQueue *dir_queue;
MPMCQueue *file_queue;
} ScannerContext;
typedef struct {
MPMCQueue *queue;
mem_arena *arena;
} WorkerContext;
/* Scan folders */
typedef struct DirQueue DirQueue;
@@ -83,6 +66,22 @@ typedef struct DirQueue {
#endif
} DirQueue;
// MPMC Queue
static MPMCQueue g_dir_queue;
static MPMCQueue g_file_queue;
typedef struct {
DirQueue *dir_queue;
mem_arena *path_arena;
mem_arena *meta_arena;
} ScannerContext;
typedef struct {
mem_arena *arena;
} WorkerContext;
// void scan_folder_windows_parallel(const char *base, ScannerContext *ctx);
// void scan_folder_posix_parallel(const char *base, ScannerContext *ctx);
void scan_folder_windows_parallel(const char *base, DirQueue *q);
//