libgslutil
1.2.3
|
Functions | |
void | gsl_stale_get_tokens (uint32_t *tok_a, uint32_t *tok_b) |
Get tokens to signify current process is fresh. More... | |
void | gsl_stale_get_nonprocess_tokens (uint32_t *tok_a, uint32_t *tok_b) |
Get tokens to signify no process associated with resource. More... | |
int | gsl_is_stale (uint32_t tok_a, uint32_t tok_b) |
Check if process associated with tokens is stale. More... | |
A set of routines which allow checking for stale processes. The function gsl_stale_get_tokens() is first called in the target process (the one being checked), and the resulting tokens are written into the file/resource that requires the check. Consumer processes then read these tokens and pass them to gsl_is_stale(), which will return 0 if the associated process is fresh or non-0 if stale.
void gsl_stale_get_tokens | ( | uint32_t * | tok_a, |
uint32_t * | tok_b | ||
) |
Get tokens to signify current process is fresh.
[out] | tok_a | Set to first token. |
[out] | tok_b | Set to second token. |
This function returns two tokens for the current process which can be used by any other process on the system to determine if this process is still running (fresh) or has exited (stale).
The two tokens returned may be written to a file etc. and any other process on the same system can use them to determine stale/fresh information at any time.
void gsl_stale_get_nonprocess_tokens | ( | uint32_t * | tok_a, |
uint32_t * | tok_b | ||
) |
Get tokens to signify no process associated with resource.
[out] | tok_a | Set to first token. |
[out] | tok_b | Set to second token. |
A degenerate case of gsl_stale_get_tokens(), this returns two special tokens which can be used to denote a file or resource is not associated with a running process (and thus if passed to gsl_is_stale() the result will always indicate a fresh file/resource).
int gsl_is_stale | ( | uint32_t | tok_a, |
uint32_t | tok_b | ||
) |
Check if process associated with tokens is stale.
tok_a | First token. |
tok_b | Second token. |
0 | on success (process is fresh). |
1 | on fail (process is stale). |
Given two tokens originally returned from gsl_stale_get_tokens(), checks to see if the process that originally created those tokens is still fresh or not.
If the process is still fresh, returns 0; otherwise, returns 1 (stale).