Re: A timeout with microsecond precision?



Yueh-Wei Hu wrote:
I noticed that g_timeout_add() using an argument with millisecond
precision.

However, I want to specify an callback function to be called every 30
microseconds.

Does glib offer this facility?

No.

I Quote:
    http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html
For the following reason:
======================================================
Note that timeout functions may be delayed, due to the processing of other event sources. Thus they should not be relied on for precise timing. After each call to the timeout function, the time of the next timeout is recalculated based on the current time and the given interval (it does not try to 'catch up' time lost in delays).
======================================================

Or how could I achieve this in gtk?

Use this function in your own loop maybe ?
http://developer.gnome.org/doc/API/2.0/glib/glib-Timers.html

Cheers,
                                             -Tristan




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