[MacRuby-devel] [MacRuby] #477: Need GCD wrapper for dispatch_once

MacRuby ruby-noreply at macosforge.org
Wed Dec 2 17:55:50 PST 2009


#477: Need GCD wrapper for dispatch_once
----------------------------------------+-----------------------------------
 Reporter:  ernest.prabhakar@…          |       Owner:  lsansonetti@…        
     Type:  defect                      |      Status:  new                  
 Priority:  minor                       |   Milestone:  MacRuby 0.5          
Component:  MacRuby                     |    Keywords:                       
----------------------------------------+-----------------------------------
 We need an API for dispatch_once:

 http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man3/dispatch_once.3.html

 http://developer.apple.com/mac/library/documentation/Performance/Reference/GCD_libdispatch_Ref/Reference/reference.html#//apple_ref/c/func/dispatch_once

 http://www.opensource.apple.com/source/libdispatch/libdispatch-84.5.1/src/once.h
 http://www.opensource.apple.com/source/libdispatch/libdispatch-84.5.1/src/once.c

 Ideally something as simple as:

 Dispatch::Once.new  { run_this_once }

 The tricky part is that the "Once" would have to allocate (the equivalent
 of) a global or static dispatch_once_t (i.e., a long). Could that be done
 with class variables?

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/477>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list