ios - NSTimer won't fire with code optimization. Works fine without -


I have some code that sets timers and then blocks the main thread type:

  self.waitingForCompletion = Yes; Dispatch_Assoc (Dispatch_Get_Global_QUU (Dispatch_QUPRRIITLLE, 0), ^ {[NSRON Loop CurrentArun Loop] Run]; NSTIMER * Timer = [Animation Timer with Time Interval: 2.F Target: Self Selector: @Selector (Waiting for complete termination) User Inc. : Zero repeats: no]; [[NSRunLoop currentRunLoop] addTimer: mode for timer: NSRunLoopCommonModes];}); While (self.waitingForCompletion); . . . - (zero) Awaiting expiration: (NSTimer *) Timer {TFLog (@ "End waiting timer timed out"); [Invalid timer]; Self.waitingForCompletion = No; }   

When I run it with optimization (-O0), the timer fires and unblocks the main thread. When I run it with the fastest, smallest (ii), the timer never sets a fire and the main thread is blocked forever. Is the problem really timer? Is this threading? Is this the wrong way to block and unblock the main thread?

If a timer is created this way, you should call [Timer Fire]

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -