Re: Usage of gtk_main_iteration_do ()




What are the chances that this will be the only process ? - in any regularlinux
 intallation we have more than 100 daemon running on the background anyhow.

Harring.
--- Russell Shaw <rjshaw iprimus com au> wrote:
Russell Shaw wrote:
Harring Figueiredo wrote:


 If you need to do something based on time, why can't you use 
g_timeout_add ?


I wanted only for the loop to run once every time slice of the linux 
scheduler.
I found the ideal function is sched_yield():

while(!gtk_main_iteration_do(0)){  // non-blocking
  a_non_blocking_function();
  sched_yield();
}

On second thoughts, the cpu would spin if this is the only process.
Might be better to just sleep for 100ms.

while(!gtk_main_iteration_do(0)){  // non-blocking
   a_non_blocking_function();
   poll(NULL,0,100);
}

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]