From d6f368a3f400fea3e89280262a8147e7ce5d855c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 22 Aug 2019 00:59:49 +0200 Subject: Move thread work from compiler/parser to thread_work file, fix use after free bug in multithreaded parser allocator --- include/compiler.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'include/compiler.h') diff --git a/include/compiler.h b/include/compiler.h index 08b74b8..ac50d28 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -5,7 +5,7 @@ #include "std/buffer.h" #include "std/buffer_view.h" #include "std/arena_allocator.h" -#include "std/thread.h" +#include "std/thread_pool.h" #include "compiler_options.h" #include "ast.h" #include "program.h" @@ -49,20 +49,17 @@ struct amal_compiler { ArenaAllocator allocator; Scope root_scope; Buffer/**/ parsers; - Buffer/**/ queued_files; HashMapType(BufferView, FileScopeReference*) file_scopes; - ParserThreadData *threads; - int usable_thread_count; bool started; - bool work_failed; amal_mutex mutex; - int generic_work_object_index; + amal_thread_pool stage_task_thread_pool; }; void amal_compiler_options_init(amal_compiler_options *self); /* If @options is NULL, then default values are used. + @options are copied. You should run @amal_program_deinit even @amal_compiler_load_file fails, to cleanup memory. This function creates a copy of @filepath so it doesn't have to survive longer than this function call. The file has to be in utf-8 format and it can optionally have utf-8 BOM. -- cgit v1.2.3