gpgme-tool: Use membuf functions to build up strings.
[gpgme.git] / src / posix-sema.c
1 /* posix-sema.c
2    Copyright (C) 2001 Werner Koch (dd9jn)
3    Copyright (C) 2001, 2002, 2004, 2007 g10 Code GmbH
4
5    This file is part of GPGME.
6
7    GPGME is free software; you can redistribute it and/or modify it
8    under the terms of the GNU Lesser General Public License as
9    published by the Free Software Foundation; either version 2.1 of
10    the License, or (at your option) any later version.
11
12    GPGME is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Lesser General Public License for more details.
16
17    You should have received a copy of the GNU Lesser General Public
18    License along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20    02111-1307, USA.  */
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <assert.h>
29 #include <errno.h>
30 #include <signal.h>
31 #include <fcntl.h>
32 #ifdef HAVE_UNISTD_H
33 # include <unistd.h>
34 #endif
35 #ifdef HAVE_SYS_TIME_H
36 # include <sys/time.h>
37 #endif
38 #ifdef HAVE_SYS_TYPES_H
39 # include <sys/types.h>
40 #endif
41
42 #include "util.h"
43 #include "sema.h"
44 #include "ath.h"
45
46 void
47 _gpgme_sema_subsystem_init ()
48 {
49 }
50
51 void
52 _gpgme_sema_cs_enter (struct critsect_s *s)
53 {
54   _gpgme_ath_mutex_lock (&s->priv);
55 }
56
57 void
58 _gpgme_sema_cs_leave (struct critsect_s *s)
59 {
60   _gpgme_ath_mutex_unlock (&s->priv);
61 }
62
63 void
64 _gpgme_sema_cs_destroy (struct critsect_s *s)
65 {
66   _gpgme_ath_mutex_destroy (&s->priv);
67   s->priv = NULL;
68 }