Re: [fltk.general] Correct way to fire graphics updates from a background thread

2013-03-18 Thread memoryl...@tin.it
>Sure; but the Fl::lock() is a mutex, so you must only take it immediately >before you want to modify the widgets, and you release it as soon as possible. >You never hold the lock for any longer than is necessary, and you do nothing >but fltk GUI operations within the lock, so there should be no

Re: [fltk.general] Correct way to fire graphics updates from a background thread

2013-03-18 Thread MacArthur, Ian (Selex ES, UK)
> In my first app I used Fl::lock, but when the app is growing I have to > be careful not to create deadlocks, as threads can communicate with > each other. Sure; but the Fl::lock() is a mutex, so you must only take it immediately before you want to modify the widgets, and you release it as soon

Re: [fltk.general] Correct way to fire graphics updates from a background thread

2013-03-18 Thread memoryl...@tin.it
Me: > > The question: what is the correct way to fire a graphics update from > a thread ? Albrecht: > Others will probably chime in and tell you more about programming with > threads and FLTK. Ian: > Ah... That quite possibly means me then... :-) > Firstly, a caveat: Rendering to the display dev

[fltk.general] Correct way to fire graphics updates from a background thread

2013-03-18 Thread memoryl...@tin.it
Hi all, just to have confirmation of what I am doing. My app is multithreaded ; the main() loop and some other working threads, receiving / sending data and doing calculations. The question: what is the correct way to fire a graphics update from a thread ? My work (omitted all sanity checks): -