python - For long running data producers in UI framework, should this be done in the event loop? -
consider clutter , enlightenment. both provide idlers , adding event callbacks event loop. neither 1 seems advocate use of threads instead suggest event driven programming.
however, if have data producer chews seconds of processing before returning?
surely adding sort of processing in idlers or event loop stop ui being responsive?
how should these sort of things ui frameworks?
fyi - using both these frameworks in python.
thanks.
if producer code cannot broken off small chunks, should use threads. clutter, , more gtk+ given threading model of gl (the context state machine stored in thread local storage), cannot used different threads except 1 called clutter_init() , clutter_main(); is, on other hand, acceptable use gmainloop facilities schedule ui update thread main loop.
clutter has example on how achieve pattern in git repository:
http://git.gnome.org/browse/clutter/tree/examples/threads.c
in short, blocking operation being executed inside thread, should schedule ui update using gobject.idle_add().
Comments
Post a Comment