Re: multithreading problem.

Cédric Marcone <marcone mdeo fr> writes:

> Yep, you're right this sounds like a great way of doing it, except that
> "idle callbacks" are called to often. If you do so, you're going to poll
> your CPU.

Usually, an idle callback should be a one-shot thing - that is return
FALSE, so it won't be called again. If the idle callback is going to
take a long time to do its thing, it should make sure it keeps the
main loop running.

Of course, what is the best thing to do depends on what exactly you
need threads for. The usual "start a thread that handles a network
connection" is often better done with non-blocking sockets and
GIOChannels, or with the GNet library (

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