/[winpt]/trunk/MyGPGME/sema.h
ViewVC logotype

Contents of /trunk/MyGPGME/sema.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Mon Jan 31 11:02:21 2005 UTC (20 years, 1 month ago) by twoaday
File MIME type: text/plain
File size: 1912 byte(s)
WinPT initial checkin.


1 /* sema.h - definitions for semaphores
2 * Copyright (C) 2001 Werner Koch (dd9jn)
3 *
4 * This file is part of MyGPGME.
5 *
6 * MyGPGME is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * MyGPGME 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 General Public License for more details.
15 *
16 * You should have received a copy of the GNU 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, USA
19 */
20
21 #ifndef SEMA_H
22 #define SEMA_H
23
24 struct critsect_s {
25 const char *name;
26 void *private;
27 };
28
29 #define DEFINE_GLOBAL_LOCK(name) \
30 struct critsect_s name = { #name, NULL }
31 #define DEFINE_STATIC_LOCK(name) \
32 static struct critsect_s name = { #name, NULL }
33
34 #define DECLARE_LOCK(name) struct critsect_s name
35 #define INIT_LOCK(a) do { \
36 (a).name = #a; \
37 (a).private = NULL; \
38 } while (0)
39 #define DESTROY_LOCK(name) _gpgme_sema_cs_destroy (&(name))
40
41
42 #define LOCK(name) do { \
43 _gpgme_sema_cs_enter ( &(name) );\
44 } while (0)
45
46 #define UNLOCK(name) do { \
47 _gpgme_sema_cs_leave ( &(name) );\
48 } while (0)
49
50
51 void _gpgme_sema_subsystem_init (void);
52 void _gpgme_sema_cs_enter ( struct critsect_s *s );
53 void _gpgme_sema_cs_leave ( struct critsect_s *s );
54 void _gpgme_sema_cs_destroy ( struct critsect_s *s );
55
56
57 #endif /* SEMA_H */
58
59
60
61
62

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26