On Fri, 21 Nov 2008 18:25:12 +0800"陈杰" <chenj@xxxxxxxxxx> wrote: > Hi, All> > After calling g_get_current_time to get the current timeval, a call to> *settimeofday* (maybe from another process), just before calling> g_cond_timed_wait will cause some problem.> > Say, the following code will cause the current process block for very> long time: [snip] You need to use a monotonic clock if you don't want to use the systemone. The system clock can be altered by a privileged user (for obviousreasons - you need to be able to set it to the current time every nowand then to accommodate clock drift). I am not certain if glib condition variables support monotonic clocks,I suspect not, but if you are using a unix-like system you can mixpthread calls with GThread calls. In particular you can use a pthreadmutex and pthread condition variable, and then apply the monotonicposix functions to that - see pthread_condattr_setclock() andclock_gettime(). First you will need to check that any target system supports monotonicclocks (most modern ones do) - see the CLOCK_MONOTONIC and_POSIX_MONOTONIC_CLOCK manifest constants, and the sysconf() function(which can be used at run time or compile time). Probably windows has something similar, but I do not use that OS. Chris _______________________________________________gtk-list mailing listgtk-list@xxxxxxxxxxxxx://mail.gnome.org/mailman/listinfo/gtk-list