csync_lock.h

Go to the documentation of this file.
00001 /*
00002  * libcsync -- a library to sync a directory with another
00003  *
00004  * Copyright (c) 2008      by Andreas Schneider <mail@cynapses.org>
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019  */
00020 
00021 #ifndef _CSYNC_LOCK_H
00022 #define _CSYNC_LOCK_H
00023 
00024 /**
00025  * @file csync_lock.h
00026  *
00027  * @brief File locking
00028  *
00029  * This prevents csync to start the same synchronization task twice which could
00030  * lead to several problems.
00031  *
00032  * @defgroup csyncLockingInternals csync file lockling internals
00033  * @ingroup csyncInternalAPI
00034  *
00035  * @{
00036  */
00037 
00038 /**
00039  * @brief Lock the client if possible.
00040  *
00041  * This functiion tries to lock the client with a lock file.
00042  *
00043  * @param lockfile  The lock file to create.
00044  *
00045  * @return  0 if the lock was successfull, less than 0 if the lock file
00046  *          couldn't be created or if it is already locked.
00047  */
00048 int csync_lock(const char *lockfile);
00049 
00050 /**
00051  * @brief  Remove the lockfile
00052  *
00053  * Only our own lock can be removed. This function can't remove a lock from
00054  * another client.
00055  *
00056  * @param lockfile  The lock file to remove.
00057  */
00058 void csync_lock_remove(const char *lockfile);
00059 
00060 /**
00061  * }@
00062  */
00063 #endif /* _CSYNC_LOCK_H */
00064 /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */
Generated on Mon Jul 5 22:58:37 2010 for doc by  doxygen 1.6.3