[#12073] Re: Ruby is much slower on linux when compiled with --enable-pthread? — "M. Edward (Ed) Borasky" <znmeb@...>

-----BEGIN PGP SIGNED MESSAGE-----

9 messages 2007/09/04

[#12085] New array methods cycle, choice, shuffle (plus bug in cycle) — David Flanagan <david@...>

Four new methods have been added to Array the Ruby 1.9 trunk. I've got

81 messages 2007/09/06
[#18036] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Charles Oliver Nutter <charles.nutter@...> 2008/07/31

Restarting this thread because I missed it the first time around and

[#18037] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Yukihiro Matsumoto <matz@...> 2008/07/31

Hi,

[#18038] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — "Gregory Brown" <gregory.t.brown@...> 2008/08/01

On Thu, Jul 31, 2008 at 7:50 PM, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

[#18046] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Michael Neumann <mneumann@...> 2008/08/01

Gregory Brown wrote:

[#18048] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Charles Oliver Nutter <charles.nutter@...> 2008/08/01

Michael Neumann wrote:

[#18051] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — "David A. Black" <dblack@...> 2008/08/01

Hi --

[#18053] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — "Wilson Bilkovich" <wilsonb@...> 2008/08/01

On 8/1/08, David A. Black <dblack@rubypal.com> wrote:

[#18074] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — David Flanagan <david@...> 2008/08/01

Wilson Bilkovich wrote:

[#18080] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Yukihiro Matsumoto <matz@...> 2008/08/02

Hi,

[#18097] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — "Pit Capitain" <pit.capitain@...> 2008/08/03

2008/8/2 Yukihiro Matsumoto <matz@ruby-lang.org>:

[#18040] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Jim Weirich <jim.weirich@...> 2008/08/01

On Jul 31, 2008, at 7:33 PM, Charles Oliver Nutter wrote:

[#18056] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Thomas Enebo <Thomas.Enebo@...> 2008/08/01

Jim Weirich wrote:

[#18059] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Jim Weirich <jim.weirich@...> 2008/08/01

On Aug 1, 2008, at 1:53 PM, Thomas Enebo wrote:

[#12096] Next 1.8.6 on Sept. 22 — Urabe Shyouhei <shyouhei@...>

Hi all.

28 messages 2007/09/09

[#12201] how about actors implemented in ruby-core itself — hemant <gethemant@...>

Hi,

12 messages 2007/09/20

[#12248] arbitrary Unicode characters in identifiers? — David Flanagan <david@...>

12 messages 2007/09/26

[#12284] gc.c -- possible logic error? — Hugh Sasse <hgs@...>

I've been looking at Tom Copeland's memory allocation problem:

36 messages 2007/09/28
[#12329] Re: gc.c -- possible logic error? — Tanaka Akira <akr@...> 2007/10/01

In article <Pine.GSO.4.64.0709281302390.26570@brains.eng.cse.dmu.ac.uk>,

[#12305] Will 1.8.6 remain compiled with VC6? — "Luis Lavena" <luislavena@...>

Hello Core developers.

29 messages 2007/09/30
[#12306] Re: Will 1.8.6 remain compiled with VC6? — "Austin Ziegler" <halostatue@...> 2007/09/30

On 9/30/07, Luis Lavena <luislavena@gmail.com> wrote:

Re: how about actors implemented in ruby-core itself

From: MenTaLguY <mental@...>
Date: 2007-09-20 23:55:32 UTC
List: ruby-core #12215
On Fri, 21 Sep 2007 07:44:43 +0900, SASADA Koichi <ko1@atdot.net> wrote:
> Hi,
> 
> Wilson Bilkovich wrote:
>> Rubinius has Actor (implemented by MenTaLguY) as a core class. If ruby
>> 1.9.x wanted to add them as well, we would be more than happy to
>> conform to the API that was chosen. Right now we basically just have
>> Actor.spawn, Actor.receive, Actor#send, and Actor.current
> 
> Can I read spec or examples of Actor?

I can give you a very brief summary of the API:

 Actor.current # => actor

   Returns the current actor

 Actor.spawn { ... } # => actor

   Creates a new actor with the given body and returns it; in the
   current implementation, each actor gets its own Ruby thread, but
   this is not necessarily guaranteed.

 Actor#send(message) # => actor
 Actor#<<(message) # => actor

   Posts a message to an actor's mailbox

 Actor.receive # => message

   Retrieves the next available message from the current actor's
   mailbox, or blocks until a message is submitted by another
   actor.

 Actor.receive { |filter| ... } # => obj

   Retrieves the next available message from the current actor's
   mailbox which matches the filter configured in the block,
   or blocks until a matching message is submitted by another
   actor.  filter is a Mailbox::Filter, which is configured
   in the block.  This form of Actor.receive returns the result
   of the action-block associated with the first matching pattern.

 Mailbox::Filter#when(pattern) { |message| ... } # => self

   Adds a receive pattern for a message object; patterns are
   matched with messages using the === case-match operator.
   The action to associate with a pattern is given as a block.

Example:

  Exit = Object.new
  Print = Struct.new :text

  parent = Actor.current

  child = Actor.spawn do
    looping = true
    while looping
      Actor.receive do |filter|
        filter.when Print do |message|
          puts message.text
        end
        filter.when Exit do
          looping = false
          parent << Exit
        end
      end
    end
  end

  child << Print["foo"]
  child << Print["bar"]
  child << Print["hoge"]
  child << Exit

  # await Exit from child
  Actor.receive do |filter|
    filter.when(Exit) {}
  end

-mental



In This Thread