summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2020-07-28 21:56:47 +1200
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2020-07-28 21:56:47 +1200
commit707772cb15b67383da44ab2348e61f1209f0ce44 (patch)
treebfcb0bccda79600d8f0f97956af1335800912b6d
parent75a75b2b3c447020e69e708d853088338894bcbf (diff)
downloadrack-remove-execution-constants.tar.gz
Expose some basic predicates for server concurrency / parallelism.remove-execution-constants
-rw-r--r--lib/rack/builder.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/rack/builder.rb b/lib/rack/builder.rb
index bc313568..e6a4fe2d 100644
--- a/lib/rack/builder.rb
+++ b/lib/rack/builder.rb
@@ -93,6 +93,17 @@ module Rack
attr :options
+ # Whether the application server will invoke the application from multiple threads. Implies {reentrant?}.
+ def multithread?
+ @options[:multithread]
+ end
+
+ # Re-entrancy is a feature of event-driven servers which may perform non-blocking operations. When an operation blocks, that particular request may yield and another request may enter the application stack.
+ # @return [Boolean] Whether the application can be invoked multiple times from the same thread.
+ def reentrant?
+ @options[:reentrant]
+ end
+
# Create a new Rack::Builder instance and return the Rack application
# generated from it.
def self.app(default_app = nil, &block)