changes: Bump to 3.8.1
[platform/upstream/evolution-data-server.git] / libedataserver / e-cancellable-locks.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
4  *
5  * This library is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, see <http://www.gnu.org/licenses/>.
16  */
17
18 #if !defined (__LIBEDATASERVER_H_INSIDE__) && !defined (LIBEDATASERVER_COMPILATION)
19 #error "Only <libedataserver/libedataserver.h> should be included directly."
20 #endif
21
22 #ifndef EDS_DISABLE_DEPRECATED
23
24 /* Do not generate bindings. */
25 #ifndef __GI_SCANNER__
26
27 #ifndef E_CANCELLABLE_LOCKS_H
28 #define E_CANCELLABLE_LOCKS_H
29
30 #include <glib.h>
31 #include <gio/gio.h>
32
33 G_BEGIN_DECLS
34
35 typedef struct _ECancellableMutex ECancellableMutex;
36 typedef struct _ECancellableRecMutex ECancellableRecMutex;
37
38 void            e_cancellable_mutex_init        (ECancellableMutex *mutex);
39 void            e_cancellable_mutex_clear       (ECancellableMutex *mutex);
40 gboolean        e_cancellable_mutex_lock        (ECancellableMutex *mutex,
41                                                  GCancellable *cancellable);
42 void            e_cancellable_mutex_unlock      (ECancellableMutex *mutex);
43 GMutex *        e_cancellable_mutex_get_internal_mutex
44                                                 (ECancellableMutex *mutex);
45
46 void            e_cancellable_rec_mutex_init    (ECancellableRecMutex *rec_mutex);
47 void            e_cancellable_rec_mutex_clear   (ECancellableRecMutex *rec_mutex);
48 gboolean        e_cancellable_rec_mutex_lock    (ECancellableRecMutex *rec_mutex,
49                                                  GCancellable *cancellable);
50 void            e_cancellable_rec_mutex_unlock  (ECancellableRecMutex *rec_mutex);
51
52 /* private structures, members should not be accessed
53  * otherwise than with above functions */
54
55 struct _ECancellableLocksBase {
56         GMutex cond_mutex;
57         GCond cond;
58 };
59
60 struct _ECancellableMutex {
61         struct _ECancellableLocksBase base;
62         GMutex mutex;
63 };
64
65 struct _ECancellableRecMutex {
66         struct _ECancellableLocksBase base;
67         GRecMutex rec_mutex;
68 };
69
70 G_END_DECLS
71
72 #endif /* E_CANCELLABLE_LOCKS_H */
73
74 #endif /* __GI_SCANNER__ */
75
76 #endif /* EDS_DISABLE_DEPRECATED */