Re: Usage of gtk_main_iteration_do ()
- From: Russell Shaw <rjshaw iprimus com au>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Usage of gtk_main_iteration_do ()
- Date: Sun, 13 Apr 2003 23:26:14 +1000
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]