[ruby-core:85726] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid

From: Eric Wong <normalperson@...>
Date: 2018-02-21 08:07:51 UTC
List: ruby-core #85726
Koichi Sasada <[email protected]> wrote:
> On 2018/02/20 18:06, Eric Wong wrote:
> >Also, what do you think about having a way to pass options to
> >thread creation like pthread_attr_t?
> 
> I like this idea because we don't need to invent new abstraction name.

Me too.

> Or `Thread.create(keyword_args...)` ? (`.create` is an example name).

One problem with a singleton method in "Thread" is separating args
intended for Thread creation vs args for block.  We have the
same problem for Thread.new, too.

Maybe Thread::Attr can be used like Struct:

```
  Thread::Attr.new(type: :coop, ...).new(_a) do |a|
    ...
  end


  class MyActor < Thread::Attr.new(type: :coop)
    ...
  end
  MyActor.new(_a) { |a| ... }
```

> Maybe Eric will be afraid keyword args cost :)

Yes, garbage from kwargs still annoys me; but that's a separate
problem which I hope can be fixed sooner.

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

In This Thread