So, I'm looking at WaitFor.c in the xorg-server/os source files. I see where it selects it's clients, but I don't see where it selects anything triggered off of a clock. I also see time() checks in the source, but it looks like the piece is the screen saver manager.
I also found selects in hw/xfree86/common/xf86Events.c, but that looks like stuff used to wake up from the screen saver.
I haven't found what I'm looking for yet. What I'm trying to find is a, hopefully very platform independent way of executing a function at regular intervals, without using a sleep anywhere in the program. Something like JavaScripts setTimeout() and setInterval(). And, it's got to be thread safe.
I'm sure the x server does this, but I don't know exactly where to look.
Any tips?
internally it builds a list of events to run at certain times, and uses the earliest time of an event to calculate the timeout to use in a select/poll statement.
That's getting to what I'm after. I've never seen the innards of the WaitForMultiple... stuff (though I make pretty good use of the api's). I've never used the used the motif libraries. I really just want to know how to do the select. So, I'm digging through Motif now looking for the guts of the XtAppAddTimeout / XtAppMainLoop. I get about a thousand hits for the XtAppMainLoop, but none on XtAppAddTimeout. Any idea where the actual select is?