Re: How do I do a delay ?



)I need to slow down my output, so I could have a control over the delay
)time, and I was thinking about the best way to achieve this. I could use
)gtk_timeout_add() that executes a function once in a certain period of time
)but it is not quite like what I want and implementing a delay like that
)would be clumsy, wouldn't it? Does anyone have any idea on how I can
)achieve this?

No, gtk_timeout_add() executes a function only once if that function
returns 'false' so you could pretty easily use it as a one-shot timer.

It's the easiest way to do it if you don't want to stop the GUI.
The only other way would be to use multi-threading.

If it's no problem that the GUI stops dead, you can use any standard C
method, such as sleep(), usleep(), select(), or whatever.

But, having learnt OOP on an LPMud (A single-threaded, multi-user environment)
I strongly advise against stopping everything dead *just* because you want
a simple delay.

Shade and Sweet Water,
-- 
Willem (@stack.nl)
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT



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