Issue #3187 has been updated by jjyr (jy j).


How about `Thread.with_configure(stack_size: 1024).new(a: 1, b: 2){}`.
`Thread.with_configure(stack_size: 1024).is_a? Thread::Config`.

ko1 (Koichi Sasada) wrote:
> Hi,
> 
> I agree with this proposal.  Also add same parameter setting feature for
> Thread.
> 
> However, I can't make good API to specify stack (VM and machine) size
> (and other parameters if there are).
> 
> There are several proposals.
> 
> Type 1: Thread creating argument (ex: `Thread.new(stack_size: 1024)`)
> Type 2: Thread global parameter (ex: `Thread.stack_size = 1024`)
> 
> I think Type 2 is not good (to set default value is okay.  However it
> conflicts other usage.  Typically thread-unsafe).
> 
> I also think Type 1 has also problem.  If you want to pass keyword
> argument "stack_size" to fiber or thread, it should be conflict.
> 
> My idea is creating new Thread (Fiber) class with new parameter:
> 
> ```ruby
>   MyThread = Thread.new_template(stack_size: 1024)
>   MyThread.new{
>     ...
>   }
> 
> # Of course "new_template" is bad name.
> ```
> 
> Any ideas?
> 
> -- 
> // SASADA Koichi at atdot dot net



----------------------------------------
Feature #3187: Allow dynamic Fiber stack size
https://bugs.ruby-lang.org/issues/3187#change-70542

* Author: mperham (Mike Perham)
* Status: Feedback
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* Target version: 
----------------------------------------
=begin
 I'd like a way to increase the size of the Fiber stack dynamically so when my program starts, I can set it to whatever value I need for the code I'm running.  4KB is too easy to run into problems when running recursive code but settling on any arbitrary static value seems pointless to me.
=end


---Files--------------------------------
fiber_stacksize.patch (5.89 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>