ios - Multiple dispatch_after can not work well -


it easy delay executing

double delayinseconds = 2.0; dispatch_time_t poptime = dispatch_time(dispatch_time_now, delayinseconds * nsec_per_sec); dispatch_after(poptime, dispatch_get_main_queue(), ^(void){     <#code executed on main queue after delay#> }); 

but make above code fail execute if putting longer delay

double delayinseconds2 = 3.0; dispatch_time_t poptime2 = dispatch_time(dispatch_time_now, delayinseconds2 * nsec_per_sec); dispatch_after(poptime2, dispatch_get_main_queue(), ^(void){     <#code executed on main queue after delay#> }); 

why execute longer 1 instead of both ? or totally wrong ?

it queue, position depend on future fire time instead of enqueue time.

if second 1 one second, insert before first one.

if want them executed concurrently (time slice single core or real concurrency multi-core cpu), put them on different queue.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -