Re: [AD] Minor flaw in windows example

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> If this is indeed the case, then it should be easy to fix; for instance,
> you could use lock files (create, say, c:\windows\temp\scrsave.txt; this
> file is deleted on exit, and if it exists when the program starts then
> just finish). Or you could use a registry key.

The problem with either of these is that if the program crashes, the
screensaver stops working.

In Win32 (or Posix for that matter), you create an OS object like a
semaphore, that is visible to all applications and if it exists you know
that another instance of the program is already running.  Objects like
that are automatically cleaned up no matter how the program dies, and will
definitely disappear if you reboot.

Is the allegro example already using the special screen saver window
callback?  It seems like it would take care of things like this.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/