From fe9a4c1201a3e0867cbc0324c55cfe90dce9415b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 17 Oct 2007 06:24:50 +0000 Subject: Add infrastructure for threading support. --- gold/gold.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'gold/gold.cc') diff --git a/gold/gold.cc b/gold/gold.cc index 8c86b9e..86fc8e68 100644 --- a/gold/gold.cc +++ b/gold/gold.cc @@ -114,6 +114,15 @@ queue_initial_tasks(const General_options& options, Workqueue* workqueue, Input_objects* input_objects, Symbol_table* symtab, Layout* layout) { + int thread_count = options.thread_count_initial(); + if (thread_count == 0) + { + thread_count = cmdline.number_of_input_files(); + if (thread_count == 0) + thread_count = 1; + } + workqueue->set_thread_count(thread_count); + if (cmdline.begin() == cmdline.end()) gold_fatal(_("no input files")); @@ -152,6 +161,15 @@ queue_middle_tasks(const General_options& options, Layout* layout, Workqueue* workqueue) { + int thread_count = options.thread_count_middle(); + if (thread_count == 0) + { + thread_count = input_objects->number_of_input_objects(); + if (thread_count == 0) + thread_count = 1; + } + workqueue->set_thread_count(thread_count); + // Now we have seen all the input files. const bool doing_static_link = (!input_objects->any_dynamic() && !parameters->output_is_shared()); @@ -228,6 +246,15 @@ queue_final_tasks(const General_options& options, Workqueue* workqueue, Output_file* of) { + int thread_count = options.thread_count_final(); + if (thread_count == 0) + { + thread_count = input_objects->number_of_input_objects(); + if (thread_count == 0) + thread_count = 1; + } + workqueue->set_thread_count(thread_count); + // Use a blocker to block the final cleanup task. Task_token* final_blocker = new Task_token(); -- cgit v1.1