I have another GLib question.  Currently I am writing some code that
needs to perform some calculations every second.  SO I want the function
called every second.  So rather than using setitimer to create a SIGALRM
event that registering a function with sigaction() would catch, I
thought I could use the g_timeout_add() function in GLib.  However I
found after playing with it that if I set it to 1 second then after 1
second it calls the function.  At the end of the function (if I return
TRUE from the function) it then sets up to call the function again in
second.  So for a function that takes say 100 - 200 milliseconds to
complete, I find that I get the behavior that my function is not called
every second but more like every 1.1 - 1.2 seconds.  I undertsnad that
gtk_timeout_add() is deprecated so is there another option (or should I
just use the standard setitimer() function)?

Travis Miller

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