Skip to content
Merged
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
8 changes: 7 additions & 1 deletion src/fiber/execution_context.cr
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ module Fiber::ExecutionContext
@@monitor = Monitor.new
end

# Returns the default number of workers to start in the execution context.
# Returns the number of threads to start in the default multi threaded
# execution context. Respects the `CRYSTAL_WORKERS` environment variable
# and otherwise returns the potential parallelism of the CPU (number of
# hardware threads).
#
# Currently unused because the default context is single threaded for
# now (this might change later with compilation flags).
def self.default_workers_count : Int32
ENV["CRYSTAL_WORKERS"]?.try(&.to_i?) || Math.min(System.cpu_count.to_i, 32)
end
Expand Down