Allow overriding n_threads on a per-Environment level - close #34
This commit is contained in:
parent
6dd70ff65e
commit
694642dfbd
@ -17,6 +17,11 @@ module Rscons
|
||||
# @return [String] The build root.
|
||||
attr_reader :build_root
|
||||
|
||||
# @return [Integer]
|
||||
# The number of threads to use for this Environment. If nil (the
|
||||
# default), the global Rscons.n_threads default value will be used.
|
||||
attr_writer :n_threads
|
||||
|
||||
# Set the build root.
|
||||
#
|
||||
# @param build_root [String] The build root.
|
||||
@ -331,7 +336,7 @@ module Rscons
|
||||
|
||||
# If needed, do a blocking wait.
|
||||
if (@threaded_commands.size > 0) and
|
||||
((completed_tcs.empty? and job.nil?) or (@threaded_commands.size >= Rscons.n_threads))
|
||||
((completed_tcs.empty? and job.nil?) or (@threaded_commands.size >= n_threads))
|
||||
completed_tcs << wait_for_threaded_commands
|
||||
end
|
||||
|
||||
@ -828,6 +833,15 @@ module Rscons
|
||||
end
|
||||
end
|
||||
|
||||
# Get the number of threads to use for parallelized builds in this
|
||||
# Environment.
|
||||
#
|
||||
# @return [Integer]
|
||||
# Number of threads to use for parallelized builds in this Environment.
|
||||
def n_threads
|
||||
@n_threads || Rscons.n_threads
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Add a build target.
|
||||
|
Loading…
x
Reference in New Issue
Block a user