On 08/10/16 10:44, Camille B. wrote:
> On Wednesday, August 10, 2016 at 6:19:18 PM UTC+2, MacArthur, Ian (Leonardo, UK) wrote:
>
> > The other API I mentioned is Allegro. I use it as a foundation for a
> > game engine and it needs to be refreshed constantly at a stable
> > framerate.
> > I use Fltk as an editor, and I plan to be able to edit stuff on the go
> > (that's why I wanted it on the background).
> > I'm actually trying my best not modify the widgets from a thread to
> > another, I'd rather send data and let the Fltk thread handle itself.
Another possible approach (not sure it's been mentioned)..
If you're just using FLTK as an editor, have you considered running
the FLTK widget in a separate process that just does the editing function
you need?
The separate process would ensure no threading or window manager issues,
and to the user both processes would look like the same app, and be running
with full control / updating speeds.
You can communicate between the processes using a number of techniques,
including IPC, shared memory, pipes, TCP, or simple files + file locking.
For instance if the user changes the FLTK editor's contents, that process
could write those changes to a file, and the main program would see the change
on the date stamp and load the file. File locking between the two processes
would ensure one isn't reading while the other is writing.