Re: GUI very slow when sleep() called...



cyrusp cia com au wrote:

Hello,

In an app I'm writing I have to put a usleep(100000) call in my
code. However when I do this my gui becomes very slow and unresponsive -
understandibly since I'm doing it in the gtk_main loop...

Is there a way to sleep but refresh the gui at the same time?

Thanks,
Cyrus

--
Cyrus Patel - cyrus linuxfan com
Dept. of Computer Engineering                           Debian GNU/Linux
University of New South Wales                           (Woody)
Sydney, Australia.                                      ICQ: 50738541
http://www.cyrusp.com   Mobile: 0402 266 731  cyrusmobile linuxfreak com

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

I am not sure it is the rigth way but it works:

  /* Wait the end of the ATM Bit-Error-Rate measure */
  return_code = wait_stopber();
  while ( return_code && (timer < TIME_OUT) )
    {
      update_display(); /* Refresh display & and update widgets's state */
      usleep(500000);   /* Just sleep 1/2 sec to see */
      return_code = wait_stopber(); /* Ask again the results */
      timer++;
    }

Could someone correct me if I am wrong.
THX
--
Michael PATRIS
mailto:michael patris etca alcatel be       Alcatel TELECOM
Tel: +(32) -71- 44.2960.                  ETCA/TEL Department
-------------------------------------------------------------
Breakthrough: It finally booted on the first try.






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