[macruby-changes] [3603] MacRuby/trunk/lib/dispatch
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 24 13:24:03 PST 2010
Revision: 3603
http://trac.macosforge.org/projects/ruby/changeset/3603
Author: ernest.prabhakar at gmail.com
Date: 2010-02-24 13:24:03 -0800 (Wed, 24 Feb 2010)
Log Message:
-----------
Document Enumeable#p_find
Modified Paths:
--------------
MacRuby/trunk/lib/dispatch/README.rdoc
MacRuby/trunk/lib/dispatch/enumerable.rb
Modified: MacRuby/trunk/lib/dispatch/README.rdoc
===================================================================
--- MacRuby/trunk/lib/dispatch/README.rdoc 2010-02-24 21:23:51 UTC (rev 3602)
+++ MacRuby/trunk/lib/dispatch/README.rdoc 2010-02-24 21:24:03 UTC (rev 3603)
@@ -237,8 +237,7 @@
==== p_find ====
-Passes each object and returns nil if none match. Similar to +find+, it returns the first object it finds that matches
-_a_ object that matches, but unlike +find+ it may not be the first since blocks -- say it with me -- "may complete out of order":
+Passes each object and returns nil if none match. Similar to +find+, it returns the first object it _finds_ for which the block is true, but unlike +find+ that may not be the _actual_ first object since blocks -- say it with me -- "may complete out of order":
(0..4).p_findall { |i| i == 5 } # => nil
@@ -248,7 +247,7 @@
== Events
-In addition to scheduling blocks directly, developers can set a block as the handler for event sources such as:
+In addition to scheduling blocks directly, GCD makes it easy to run a block in response to various system events, including:
* Timers
* Signals
@@ -257,7 +256,7 @@
* Mach ports
* Custom application-specific events
-When the source “fires,” GCD will schedule the handler on the specific queue if it is not currently running, or coalesce pending events if it is. This provides excellent responsiveness without the expense of either polling or binding a thread to the event source. Plus, since the handler is never run more than once at a time, the block doesn’t even need to be reentrant.
+When the source “fires,” GCD will schedule the handler on the specific queue if it is not currently running, or -- more importantly -- coalesce pending events if it is. This provides excellent responsiveness without the expense of either polling or binding a thread to the event source. Plus, since the handler is never run more than once at a time, the block doesn’t even need to be reentrant.
=== Timer Example
Modified: MacRuby/trunk/lib/dispatch/enumerable.rb
===================================================================
--- MacRuby/trunk/lib/dispatch/enumerable.rb 2010-02-24 21:23:51 UTC (rev 3602)
+++ MacRuby/trunk/lib/dispatch/enumerable.rb 2010-02-24 21:24:03 UTC (rev 3603)
@@ -61,7 +61,7 @@
# Parallel +collect+ plus +inject+
# Accumulates from +initial+ via +op+ (default = '+')
- # Note: each object will only run one p_mapreduce at a time
+ # Note: each object can only run one p_mapreduce at a time
def p_mapreduce(initial, op=:+, stride=1, priority=nil, &block)
# Check first, since exceptions from a Dispatch block can act funky
raise ArgumentError if not initial.respond_to? op
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100224/a62663b9/attachment.html>
More information about the macruby-changes
mailing list