libkdenetwork Library API Documentation

sema.h

00001 /* sema.h - Definitions for semaphores. 00002 Copyright (C) 2000 Werner Koch (dd9jn) 00003 Copyright (C) 2001, 2003 g10 Code GmbH 00004 00005 This file is part of GPGME. 00006 00007 GPGME is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 GPGME is distributed in the hope that it will be useful, but 00013 WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with GPGME; if not, write to the Free Software Foundation, 00019 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 00020 00021 #ifndef SEMA_H 00022 #define SEMA_H 00023 00024 struct critsect_s 00025 { 00026 const char *name; 00027 void *private; 00028 }; 00029 00030 #define DEFINE_GLOBAL_LOCK(name) \ 00031 struct critsect_s name = { #name, NULL } 00032 #define DEFINE_STATIC_LOCK(name) \ 00033 static struct critsect_s name = { #name, NULL } 00034 00035 #define DECLARE_LOCK(name) \ 00036 struct critsect_s name 00037 #define INIT_LOCK(a) \ 00038 do \ 00039 { \ 00040 (a).name = #a; \ 00041 (a).private = NULL; \ 00042 } \ 00043 while (0) 00044 #define DESTROY_LOCK(name) _gpgme_sema_cs_destroy (&(name)) 00045 00046 00047 #define LOCK(name) \ 00048 do \ 00049 { \ 00050 _gpgme_sema_cs_enter (&(name)); \ 00051 } \ 00052 while (0) 00053 00054 #define UNLOCK(name) \ 00055 do \ 00056 { \ 00057 _gpgme_sema_cs_leave (&(name)); \ 00058 } \ 00059 while (0) 00060 00061 void _gpgme_sema_subsystem_init (void); 00062 void _gpgme_sema_cs_enter (struct critsect_s *s); 00063 void _gpgme_sema_cs_leave (struct critsect_s *s); 00064 void _gpgme_sema_cs_destroy (struct critsect_s *s); 00065 00066 #endif /* SEMA_H */
KDE Logo
This file is part of the documentation for libkdenetwork Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:48:47 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003