1 /* Definitions for thread support. 2 * 3 * JC, 9/5/94 4 * 30/7/99 RP, JC 5 * - reworked for posix/solaris threads 6 * 28/9/99 JC 7 * - restructured, made part of public API 8 */ 9 10 /* 11 12 This file is part of VIPS. 13 14 VIPS is free software; you can redistribute it and/or modify 15 it under the terms of the GNU Lesser General Public License as published by 16 the Free Software Foundation; either version 2 of the License, or 17 (at your option) any later version. 18 19 This program is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU Lesser General Public License for more details. 23 24 You should have received a copy of the GNU Lesser General Public License 25 along with this program; if not, write to the Free Software 26 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 27 02110-1301 USA 28 29 */ 30 31 /* 32 33 These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk 34 35 */ 36 37 #ifndef VIPS_SEMAPHORE_H 38 #define VIPS_SEMAPHORE_H 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif /*__cplusplus*/ 43 44 #include <vips/vips.h> 45 #include <vips/thread.h> 46 47 /* Implement our own semaphores. 48 */ 49 typedef struct { 50 char *name; 51 int v; 52 53 GMutex *mutex; 54 GCond *cond; 55 } VipsSemaphore; 56 57 int vips_semaphore_up( VipsSemaphore *s ); 58 int vips_semaphore_down( VipsSemaphore *s ); 59 int vips_semaphore_upn( VipsSemaphore *s, int n ); 60 int vips_semaphore_downn( VipsSemaphore *s, int n ); 61 void vips_semaphore_destroy( VipsSemaphore *s ); 62 void vips_semaphore_init( VipsSemaphore *s, int v, char *name ); 63 64 #ifdef __cplusplus 65 } 66 #endif /*__cplusplus*/ 67 68 #endif /*VIPS_SEMAPHORE_H*/ 69