input - iOS - dispatcherTimer blocking touches events? -
i using dispatcher source timer update view @ different frame rates. (8, 12 or 24 fps)
here code initializes dispatchertimer , function used create timer.
(this function directly taken apple doc in subsection "creating timer": http://developer.apple.com/library/mac/#documentation/general/conceptual/concurrencyprogrammingguide/gcdworkqueues/gcdworkqueues.html)
call:
self.dispatchtimer = [self createdispatchtimerwithinterval:self.project.frameduration * nsec_per_sec leeway:0.0 * nsec_per_sec queue:dispatch_get_main_queue() block:displayframe];
function:
- (dispatch_source_t)createdispatchtimerwithinterval:(uint64_t)interval leeway:(uint64_t)leeway queue:(dispatch_queue_t)queue block:(dispatch_block_t)block { dispatch_source_t timer = dispatch_source_create(dispatch_source_type_timer, 0, 0, queue); if (timer) { dispatch_source_set_timer(timer, dispatch_walltime(null, 0), interval, leeway); dispatch_source_set_event_handler(timer, block); dispatch_resume(timer); } return timer; }
my view updates perfectly, touch events not caught. first bet block "displayframe" takes processing time because if reduce frameduration 0.5 second or so, touch events caught.
i tested on ios 4 ipad 2.
any or hint appreciated!
etienne
update
i have asked similar question on apple developper forum, here answer got: https://devforums.apple.com/thread/156633?tstart=0
the main run loop drains main queue after each pass through runloop. think you're right when duration short. if source adding new blocks queue faster can drained, expect runloop never resume processing events (since it's trying drain queue).
Comments
Post a Comment