Issue #6695 has been updated by brixen (Brian Ford).


I object to this API for setting stack size from Ruby for at least the two following reasons:

1. Stack size is an implementation detail and coupling Ruby code to details of a particular implementation is undesirable. Applications may be developed on one implementation and deployed on another. Or details affecting stack size may change between versions of a single implementation.
2. Stack size may depend on code not in the application or library (eg a library using Thread.new that calls application code or application code that different versions or implementations of a library).

This setting should be a VM configuration option, not a Ruby method API.

Thread#name doesn't need a new Thread.new API.

Cheers,
Brian
----------------------------------------
Feature #6695: Configuration for Thread/Fiber creation
https://bugs.ruby-lang.org/issues/6695#change-28231

Author: ko1 (Koichi Sasada)
Status: Assigned
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 2.0.0


=begin
= Abstract

With Feature #6694, the following configuration parameters should be allowed for Thread/Fiber creation.

Group1 (new parameters):
* name: Thread/Fiber name
* vm_stack_size: VM's stack size
* machine_stack_size: Machine stack size

Group2 (existing parameters):
* local_storage: Initial Thread/Fiber local parameters
* thread_group: Thread group (Thread only)
* priority: Initial priority Thread#priority= (Thread only)
* abort_on_exception: abort on exception (Thread only)

= Background

With Feature #6694, we have a way to specify configurations for Thread creation.  Fiber.new() don't receive any parameters now.

= Proposal

This is a initial proposal of configuration for Thread/Fiber creation.

Group1 (new parameters):
* name: Thread/Fiber name
* vm_stack_size: VM's stack size
* machine_stack_size: Machine stack size

vm_stack_size and machine_stack_size are OS dependent (This means that it will be *hint* parameter).

Thread#inspect should use `name' parameter.

I also propose a new method Thread#name to get the thread name specified by this parameter.

Group2 (existing parameters):
* local_storage: Initial Thread/Fiber local parameters
* thread_group: Thread group (Thread only)
* priority: Initial priority Thread#priority= (Thread only)
* abort_on_exception: abort on exception (Thread only)

Now, we can specify Group2 parameters only *after* thread creation.  With this parameter, we can specify parameters before thread creation.

=end



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