Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mx_flock: Add mx_funlock_nodelete
Add function to release the lock without removing the logfile. This is
useful for forked children, which inherited the lock and just need to
give it up.
  • Loading branch information
donald committed Sep 17, 2021
1 parent 2601e06 commit 0be33f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mx_flock.c
Expand Up @@ -155,6 +155,13 @@ int mx_funlock(struct mx_flock *lock)
return res;
}

/* as above, but don't delete lock file
*/
void mx_funlock_nodelete(struct mx_flock *lock) {
_flock_close(lock);
_flock_free(lock);
}

void mx_flock_free(struct mx_flock *lock)
{
_flock_free(lock);
Expand Down
1 change: 1 addition & 0 deletions mx_flock.h
Expand Up @@ -10,6 +10,7 @@ struct mx_flock {

struct mx_flock *mx_flock(int operation, char *fmt, ...);
int mx_funlock(struct mx_flock *lock);
void mx_funlock_nodelete(struct mx_flock *lock);
void mx_flock_free(struct mx_flock *lock);

#endif

0 comments on commit 0be33f7

Please sign in to comment.