diff options
author | Ian Lance Taylor <iant@google.com> | 2007-10-17 06:24:50 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-10-17 06:24:50 +0000 |
commit | fe9a4c1201a3e0867cbc0324c55cfe90dce9415b (patch) | |
tree | 1cfc4aa11a0b71f31000b3fb7abecc367dd52180 /gold/gold.cc | |
parent | ae326da8ebcb14de70678bb726732a1c8923d63c (diff) | |
download | binutils-fe9a4c1201a3e0867cbc0324c55cfe90dce9415b.zip binutils-fe9a4c1201a3e0867cbc0324c55cfe90dce9415b.tar.gz binutils-fe9a4c1201a3e0867cbc0324c55cfe90dce9415b.tar.bz2 |
Add infrastructure for threading support.
Diffstat (limited to 'gold/gold.cc')
-rw-r--r-- | gold/gold.cc | 27 |
1 files changed, 27 insertions, 0 deletions
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(); |