forked from amir/filehasher
Replacing Malloc and strdup in scan helper function with FileEntry and path arenas
This commit is contained in:
35
platform.h
35
platform.h
@@ -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);
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user