Re: Threads !!!



Chris <chris starforge co uk> writes:

> How about having a single "worker" thread that does all the updating, and
> all the other threads in your program sent it requests with the instructions
> about what needs to be done and the data to do it? Possible implementation:

In fact, the glib mainloop has good support for this design. Just use
g_idle_add (function_that_does_updating, data). This way only the
thread that runs the mainloop will do any updating. You don't even
have to worry about locking, as g_idle_add() will do the necessary
locking for you.



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