You will need to use some kind of cross-process design. I'm from Linux practice, but I suspect shared memory or a semaphore would be a decent choice. Since you will not use the semaphore for normal operation, this may look a little strange or even stop working. But I think a simple semaphore approach would be this:
Load: sem_open to create a semaphore with a unique name and number 0, or to open an already created semaphore. Then sem_post, to increase its value.
When checking: sem_getvalue to read the current account stored in the semaphore.
: sem_wait ( -), sem_close, . , sem_unlink sem_destroy, .
( , , sem_t. , , .)