~ubuntu-branches/ubuntu/karmic/libtinymail/karmic

« back to all changes in this revision

Viewing changes to libtinymail-camel/camel-lite/camel/camel-lock.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-10-12 11:21:12 UTC
  • Revision ID: james.westby@ubuntu.com-20071012112112-fod9fs7yrooxjr7i
Tags: upstream-0.0.2
ImportĀ upstreamĀ versionĀ 0.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 
2
 *
 
3
 * Author: Michael Zucchi <notzed@ximian.com>
 
4
 *
 
5
 * Copyright (C) 1999 Ximian (www.ximian.com/).
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or 
 
8
 * modify it under the terms of version 2 of the GNU Lesser General Public 
 
9
 * License as published by the Free Software Foundation.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
19
 * USA
 
20
 */
 
21
 
 
22
#ifndef _CAMEL_LOCK_H
 
23
#define _CAMEL_LOCK_H
 
24
 
 
25
#include <camel/camel-exception.h>
 
26
 
 
27
/* for .lock locking, retry, delay and stale counts */
 
28
#define CAMEL_LOCK_DOT_RETRY (5) /* number of times to retry lock */
 
29
#define CAMEL_LOCK_DOT_DELAY (2) /* delay between locking retries */
 
30
#define CAMEL_LOCK_DOT_STALE (60) /* seconds before a lock becomes stale */
 
31
 
 
32
/* for locking folders, retry/interretry delay */
 
33
#define CAMEL_LOCK_RETRY (5) /* number of times to retry lock */
 
34
#define CAMEL_LOCK_DELAY (2) /* delay between locking retries */
 
35
 
 
36
G_BEGIN_DECLS
 
37
 
 
38
typedef enum {
 
39
        CAMEL_LOCK_READ,
 
40
        CAMEL_LOCK_WRITE,
 
41
} CamelLockType;
 
42
 
 
43
/* specific locking strategies */
 
44
int camel_lock_dot(const char *path, CamelException *ex);
 
45
int camel_lock_fcntl(int fd, CamelLockType type, CamelException *ex);
 
46
int camel_lock_flock(int fd, CamelLockType type, CamelException *ex);
 
47
 
 
48
void camel_unlock_dot(const char *path);
 
49
void camel_unlock_fcntl(int fd);
 
50
void camel_unlock_flock(int fd);
 
51
 
 
52
/* lock a folder in a standard way */
 
53
int camel_lock_folder(const char *path, int fd, CamelLockType type, CamelException *ex);
 
54
void camel_unlock_folder(const char *path, int fd);
 
55
 
 
56
G_END_DECLS
 
57
 
 
58
#endif /* !_CAMEL_LOCK_H */