Am 16.02.2013 14:10, schrieb Gonzalo Garramuno: > I would like my application to have only one instance of it running at a > time. However I am unsure how to implement this. > If the user opens another instance the contents of what it opened should go > to the already opened instance. > As an example, I would put emacs. > > How would I go about coding this? Pipes? Sockets? None of the above.
For OS independence I would use: http://www.fltk.org/doc-1.3/classFl__Preferences.html together with repeat_timeout( cb ) it should be fine http://www.fltk.org/doc-1.3/classFl.html#ae5373d1d50c2b0ba38280d78bb6d2628 Application reads the "lock" key and if none exists, writes a new "lock" key containing e.g. a PID. Second instance reads the "lock" key, checks if the PID exists and writes a "command" key with instructions for the first instance and quits. The first instance polls through repeat_timeout() the "command" key and does what it needs. On exit the first application deletes the "lock" key. hope this helps Kai-Uwe _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk