A closing app releases its instance lock only at CloseWindow, after application cleanup; the old steal loop gave up after 2 s of SIGTERM nudges, so a launch racing a slow shutdown was rejected with no window. Widen the budget to 3.5 s, escalate once to SIGKILL guarded by a /proc/<pid>/comm same-application check (a recycled pid never takes the hit), and add KryonReleaseInstanceLock() so apps can drop the lock the moment their main loop ends.
21 lines
888 B
C
21 lines
888 B
C
#ifndef KRYON_APP_INSTANCE_H
|
|
#define KRYON_APP_INSTANCE_H
|
|
|
|
/* Kryon applications run as a single instance by default. Call this before
|
|
* InitWindow when concurrent windows are intentional. */
|
|
void SetSingleInstance(int enabled);
|
|
int SingleInstanceEnabled(void);
|
|
/* Nonzero when InitWindow refused to create a window because another
|
|
* instance with the same title-key already holds the lock. Frame APIs
|
|
* become no-ops in that state; apps should check this right after
|
|
* InitWindow and exit (or forward to the running instance). */
|
|
int InstanceRejected(void);
|
|
|
|
/* Drop the single-instance lock immediately (idempotent). Apps with a
|
|
* slow shutdown path call this right when their main loop ends so a
|
|
* freshly launched instance does not have to steal the lock from a
|
|
* process that is merely cleaning up. CloseWindow releases it too. */
|
|
void KryonReleaseInstanceLock(void);
|
|
|
|
#endif
|