Re: multithread



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



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