#476: GCD Groups should be a wrapper around dispatch, not its own invocation style ----------------------------------------+----------------------------------- Reporter: ernest.prabhakar@… | Owner: lsansonetti@… Type: enhancement | Status: new Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: gcd ----------------------------------------+----------------------------------- Comment(by joshua.ballanco@…): Ideally, I'd prefer a change such that the programmer doesn't need to worry about the difference between a dispatch group and a dispatch queue. There would be only one "Dispatch" class with methods "sync", "async", "apply", etc. Dispatch.sync would take a name parameter (a symbol?), and subsequent calls to Dispatch.sync with the same parameter would dispatch to the same queue. Dispatch.async would just take an optional priority parameter. Dispatch.apply would iterate over a collection. All would return a group which could be optionally captured for later calls to wait, and would accept an optional group argument to add a block to a pre- existing group. So, for example: {{{ notifications = Dispatch.async do send_start_notification end url_fetching = Dispatch.apply(LIST_OF_URLS) do |url| connection = open(url) Dispatch.sync(:disk_dispatch) do File.open(URL_FILE) { |f| f << connection.read } end end url_fetching.wait Dispatch.async(:group => notifications) do send_finish_notification end do_other_work notifications.wait exit }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/476#comment:2> MacRuby <http://macruby.org/>