@@ -131,9 +131,7 @@ <h2>Overview</h2><div class="docstring">
131131< li > < code > max_queue</ code > : The maximum number of tasks that may be waiting in the work queue at
132132any one time. When the queue size reaches < code > max_queue</ code > and no new threads can be created,
133133subsequent tasks will be rejected in accordance with the configured < code > fallback_policy</ code > .</ li >
134- < li > < code > auto_terminate</ code > : When true (default) an < code > at_exit</ code > handler will be registered which
135- will stop the thread pool when the application exits. See below for more information
136- on shutting down thread pools.</ li >
134+ < li > < code > auto_terminate</ code > : When true (default), the threads started will be marked as daemon.</ li >
137135< li > < code > fallback_policy</ code > : The policy defining how rejected tasks are handled.</ li >
138136</ ul >
139137
@@ -163,15 +161,11 @@ <h2>Overview</h2><div class="docstring">
163161
164162< p > On some runtime platforms (most notably the JVM) the application will not
165163exit until all thread pools have been shutdown. To prevent applications from
166- "hanging" on exit all thread pools include an < code > at_exit</ code > handler that will
167- stop the thread pool when the application exits. This handler uses a brute
168- force method to stop the pool and makes no guarantees regarding resources being
169- used by any tasks still running. Registration of this < code > at_exit</ code > handler can be
170- prevented by setting the thread pool's constructor < code > :auto_terminate</ code > option to
171- < code > false</ code > when the thread pool is created. All thread pools support this option.</ p >
172-
173- < pre class ="code ruby "> < code class ="ruby "> < span class ='id identifier rubyid_pool1 '> pool1</ span > < span class ='op '> =</ span > < span class ='const '> < span class ='object_link '> < a href ="../Concurrent.html " title ="Concurrent (module) "> Concurrent</ a > </ span > </ span > < span class ='op '> ::</ span > < span class ='const '> FixedThreadPool</ span > < span class ='period '> .</ span > < span class ='id identifier rubyid_new '> < span class ='object_link '> < a href ="#initialize-instance_method " title ="Concurrent::FixedThreadPool#initialize (method) "> new</ a > </ span > </ span > < span class ='lparen '> (</ span > < span class ='int '> 5</ span > < span class ='rparen '> )</ span > < span class ='comment '> # an `at_exit` handler will be registered
174- </ span > < span class ='id identifier rubyid_pool2 '> pool2</ span > < span class ='op '> =</ span > < span class ='const '> < span class ='object_link '> < a href ="../Concurrent.html " title ="Concurrent (module) "> Concurrent</ a > </ span > </ span > < span class ='op '> ::</ span > < span class ='const '> FixedThreadPool</ span > < span class ='period '> .</ span > < span class ='id identifier rubyid_new '> < span class ='object_link '> < a href ="#initialize-instance_method " title ="Concurrent::FixedThreadPool#initialize (method) "> new</ a > </ span > </ span > < span class ='lparen '> (</ span > < span class ='int '> 5</ span > < span class ='comma '> ,</ span > < span class ='label '> auto_terminate:</ span > < span class ='kw '> false</ span > < span class ='rparen '> )</ span > < span class ='comment '> # prevent `at_exit` handler registration
164+ "hanging" on exit, all threads can be marked as daemon according to the
165+ < code > :auto_terminate</ code > option.</ p >
166+
167+ < pre class ="code ruby "> < code class ="ruby "> < span class ='id identifier rubyid_pool1 '> pool1</ span > < span class ='op '> =</ span > < span class ='const '> < span class ='object_link '> < a href ="../Concurrent.html " title ="Concurrent (module) "> Concurrent</ a > </ span > </ span > < span class ='op '> ::</ span > < span class ='const '> FixedThreadPool</ span > < span class ='period '> .</ span > < span class ='id identifier rubyid_new '> < span class ='object_link '> < a href ="#initialize-instance_method " title ="Concurrent::FixedThreadPool#initialize (method) "> new</ a > </ span > </ span > < span class ='lparen '> (</ span > < span class ='int '> 5</ span > < span class ='rparen '> )</ span > < span class ='comment '> # threads will be marked as daemon
168+ </ span > < span class ='id identifier rubyid_pool2 '> pool2</ span > < span class ='op '> =</ span > < span class ='const '> < span class ='object_link '> < a href ="../Concurrent.html " title ="Concurrent (module) "> Concurrent</ a > </ span > </ span > < span class ='op '> ::</ span > < span class ='const '> FixedThreadPool</ span > < span class ='period '> .</ span > < span class ='id identifier rubyid_new '> < span class ='object_link '> < a href ="#initialize-instance_method " title ="Concurrent::FixedThreadPool#initialize (method) "> new</ a > </ span > </ span > < span class ='lparen '> (</ span > < span class ='int '> 5</ span > < span class ='comma '> ,</ span > < span class ='label '> auto_terminate:</ span > < span class ='kw '> false</ span > < span class ='rparen '> )</ span > < span class ='comment '> # mark threads as non-daemon
175169</ span > </ code > </ pre >
176170
177171
@@ -189,7 +183,7 @@ <h2>Overview</h2><div class="docstring">
189183
190184 < li > < a href ="http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html " target ="_parent " title ="Java ExecutorService interface "> Java ExecutorService interface</ a > </ li >
191185
192- < li > < a href ="http ://ruby-doc.org//core-2.2.0/Kernel .html#method-i-at_exit " target ="_parent " title ="Kernel#at_exit " > Kernel#at_exit </ a > </ li >
186+ < li > < a href ="https ://docs.oracle.com/javase/8/docs/api/java/lang/Thread .html#setDaemon-boolean- " target ="_parent " title ="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#setDaemon-boolean- " > https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#setDaemon-boolean- </ a > </ li >
193187
194188 </ ul >
195189
@@ -365,17 +359,17 @@ <h3 class="signature first" id="initialize-instance_method">
365359 < pre class ="lines ">
366360
367361
362+ 194
363+ 195
364+ 196
365+ 197
366+ 198
367+ 199
368368200
369- 201
370- 202
371- 203
372- 204
373- 205
374- 206
375- 207</ pre >
369+ 201</ pre >
376370 </ td >
377371 < td >
378- < pre class ="code "> < span class ="info file "> # File 'lib/concurrent-ruby/concurrent/executor/fixed_thread_pool.rb', line 200 </ span >
372+ < pre class ="code "> < span class ="info file "> # File 'lib/concurrent-ruby/concurrent/executor/fixed_thread_pool.rb', line 194 </ span >
379373
380374< span class ='kw '> def</ span > < span class ='id identifier rubyid_initialize '> initialize</ span > < span class ='lparen '> (</ span > < span class ='id identifier rubyid_num_threads '> num_threads</ span > < span class ='comma '> ,</ span > < span class ='id identifier rubyid_opts '> opts</ span > < span class ='op '> =</ span > < span class ='lbrace '> {</ span > < span class ='rbrace '> }</ span > < span class ='rparen '> )</ span >
381375 < span class ='id identifier rubyid_raise '> raise</ span > < span class ='const '> ArgumentError</ span > < span class ='period '> .</ span > < span class ='id identifier rubyid_new '> new</ span > < span class ='lparen '> (</ span > < span class ='tstring '> < span class ='tstring_beg '> '</ span > < span class ='tstring_content '> number of threads must be greater than zero</ span > < span class ='tstring_end '> '</ span > </ span > < span class ='rparen '> )</ span > < span class ='kw '> if</ span > < span class ='id identifier rubyid_num_threads '> num_threads</ span > < span class ='period '> .</ span > < span class ='id identifier rubyid_to_i '> to_i</ span > < span class ='op '> <</ span > < span class ='int '> 1</ span >
0 commit comments