00001 /*************************************************************************** 00002 $RCSfile$ 00003 ------------------- 00004 cvs : $Id: fslock.h 818 2005-08-04 04:55:48Z aquamaniac $ 00005 begin : Wed Mar 24 2004 00006 copyright : (C) 2004 by Martin Preuss 00007 email : martin@libchipcard.de 00008 00009 *************************************************************************** 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public * 00013 * License as published by the Free Software Foundation; either * 00014 * version 2.1 of the License, or (at your option) any later version. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00019 * Lesser General Public License for more details. * 00020 * * 00021 * You should have received a copy of the GNU Lesser General Public * 00022 * License along with this library; if not, write to the Free Software * 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00024 * MA 02111-1307 USA * 00025 * * 00026 ***************************************************************************/ 00027 00028 00029 #ifndef GWEN_FSLOCK_H 00030 #define GWEN_FSLOCK_H 00031 00047 00048 #ifdef __cplusplus 00049 extern "C" { 00050 #endif 00051 00052 00053 #define GWEN_FSLOCK_CBID_IO "GWEN_FSLOCK_CBID_IO" 00054 00055 #define GWEN_FSLOCK_TIMEOUT_NONE (0) 00056 #define GWEN_FSLOCK_TIMEOUT_FOREVER (-1) 00057 00058 00059 typedef struct GWEN_FSLOCK GWEN_FSLOCK; 00060 00061 typedef enum { 00062 GWEN_FSLock_TypeUnknown=0, 00063 GWEN_FSLock_TypeFile, 00064 GWEN_FSLock_TypeDir 00065 } GWEN_FSLOCK_TYPE; 00066 00067 00068 typedef enum { 00069 GWEN_FSLock_ResultOk=0, 00070 GWEN_FSLock_ResultError, 00071 GWEN_FSLock_ResultTimeout, 00072 GWEN_FSLock_ResultBusy, 00073 GWEN_FSLock_ResultNoLock, 00074 GWEN_FSLock_ResultUserAbort 00075 } GWEN_FSLOCK_RESULT; 00076 00077 00078 #include <gwenhywfar/gwenhywfarapi.h> 00079 #include <gwenhywfar/types.h> 00080 #include <gwenhywfar/db.h> 00081 00082 00083 GWENHYWFAR_API 00084 GWEN_FSLOCK *GWEN_FSLock_new(const char *fname, GWEN_FSLOCK_TYPE t); 00085 GWENHYWFAR_API 00086 void GWEN_FSLock_free(GWEN_FSLOCK *fl); 00087 00098 GWENHYWFAR_API 00099 GWEN_FSLOCK_RESULT GWEN_FSLock_Lock(GWEN_FSLOCK *fl, int timeout); 00100 00105 GWENHYWFAR_API 00106 GWEN_FSLOCK_RESULT GWEN_FSLock_Unlock(GWEN_FSLOCK *fl); 00107 00108 00109 #ifdef __cplusplus 00110 } 00111 #endif 00112 /* defgroup */ 00114 00115 #endif 00116 00117 00118 00119 00120 00121 00122