One tiny comment. 'sleep' is not necessarily what you want to use in a multi-threaded program, as it puts the entire process to sleep. A thread-aware version of 'sleep' called 'nanosleep' (#include <time.h>) may be more suitable for you. If I am not mistaken, 'sleep' only operates on a multiple of 1 second, whereas 'nanosleep' has a much finer resolution.
Regards, Nickolai On 11/16/05, Bryan Christ <[EMAIL PROTECTED]> wrote: > > How accurate does your timer need to be? If it doesn't have to be very > precise, I would do something like... > > gpointer my_thread(gpointer anything) > { > gboolean exit_flag=TRUE; > > > while(exit_flag==FALSE) > { > exit_flag=do_work(); > sleep(timer_length); > } > > g_thread_exit(anything); > } > > Bryan > > yeajchao wrote: > > Hello everybody > > my program involved in multithread > > but I have no any idea about it > > in my program,there need two threads,and each > > thread has a timer > > when the timer is timeout ,it will awake the > > corresponding thread, > > and after the thread finished its work,it will > > sleep again ,wait for its timer > > > > can anybody will be so kind as to give me some > > advise ? > > an example may even better > > Thanks in advance ! > > yeajchao > > > > > > > > > > > > > > > > ___________________________________________________________ > > 雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱 > > http://cn.mail.yahoo.com > > > > _______________________________________________ > > gtk-list mailing list > > gtk-list@gnome.org > > http://mail.gnome.org/mailman/listinfo/gtk-list > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list >
_______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list