Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/ceedling/par_map.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@


def par_map(n, things, &block)
if (things.length <= 1)
yield things.pop() if not things.empty?
return
end

queue = Queue.new
things.each { |thing| queue << thing }
threads = (1..n).collect do

num_threads = [n, things.length].min()
threads = (1..num_threads).collect do
Thread.new do
begin
while true
Expand Down
8 changes: 7 additions & 1 deletion lib/ceedling/preprocessinator_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'ceedling/par_map'


class PreprocessinatorHelper
Expand Down Expand Up @@ -43,7 +44,12 @@ def preprocess_files_smartly(file_list, preprocess_file_proc)
if (@configurator.project_use_deep_dependencies)
@task_invoker.invoke_test_preprocessed_files(file_list)
else
file_list.each { |file| preprocess_file_proc.call( yield(file) ) }
found_files = Array.new
file_list.each { |file| found_files << yield(file) }

par_map(PROJECT_COMPILE_THREADS, found_files) do |file|
preprocess_file_proc.call(file)
end
end
end

Expand Down