g_timeout_add minimum period



Hi,

I've perused the net and this email list and can't find an answer to
this question. If no one on this list knows, I guess I'll have to unpack
the source and look for myself :-)

Here's the question: what is the minimum timeout period that can be
specified on a Linux system using the g_timeout_add() function, and what
determines it?

According to the online API documentation, g_timeout_add() takes three
arguments: the timeout in milliseconds, a pointer to the callback
function, and some data to pass to that function. There is no specified
lower limit on the timeout period. However, every source code
example I see on the web is using timeout values of 1000 (1 second) or
greater. I'm looking for a timeout of 50ms. However, when I try this, I
get a consistent 200ms timeout. Is this a limitation of the glib timer
function, or a limitation of the default task-switching of the Linux
kernel? Or a configuration set-up option somewhere? (This is on a Gentoo
Athlon with a 2.6.15 kernel.)

I don't need a precise 50ms timeout; I know g_timer_add() restarts the
timer at the end of the callback processing. Doesn't matter. I just need
somewhere around 50ms. I seem to be in some gray area--50ms feels too
slow to me to be concerning myself with working with the available 
real-time libraries, but maybe it's too fast for the default time-slicing.

If this isn't just some dumb configuration mishap on my part and
g_timer_add() just can't go that slow, I suppose the next best
alternative is to use the kernel timer facilities (signal/poll) and deal
with the associated threading issues. Has anyone found another simpler
approach?

Thanks.

-- 
                               Bob Johnson
                               KE6FIS arrl net



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