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: GTimeVal tv, tv2; g_get_current_time (&tv); /* simulate a call from another process to change the current datetime to some *older* time */ tv2 = tv; tv2.tv_sec -= 31536000; tv.tv_sec += 10; g_thread_init (NULL); GCond *cond = g_cond_new (); GMutex *mutex = g_mutex_new (); /* need root privilege */ settimeofday ((struct timeval *) (&tv2), NULL); g_mutex_lock (mutex); g_print ("Before entering g_cond_timed_wait\n"); /* will block here for very long time */ g_cond_timed_wait (cond, mutex, &tv); g_print ("End of g_cond_timed_wait\n");
_______________________________________________ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list