1 /* pthread.h dummy. 2 Copyright (C) 2001, 2004, 2005 Axis Communications AB. 3 All rights reserved. 4 5 Redistribution and use in source and binary forms, with or without 6 modification, are permitted provided that the following conditions 7 are met: 8 9 1. Redistributions of source code must retain the above copyright 10 notice, this list of conditions and the following disclaimer. 11 12 2. Neither the name of Axis Communications nor the names of its 13 contributors may be used to endorse or promote products derived 14 from this software without specific prior written permission. 15 16 THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS 17 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS 20 COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 21 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 POSSIBILITY OF SUCH DAMAGE. */ 28 29 /* Simple fallback-include to enable thread-enabled exception support 30 for libgcc, but with posix-interface to a default-dummy, so a posix 31 library can optionally be linked in, which isn't possible if 32 gthr-single.h is used. No other use is supported; *DO NOT* think 33 this gives you a valid pthread interface to use in your applications. */ 34 35 #ifndef _PTHREAD_FAKE 36 #define _PTHREAD_FAKE 37 38 #ifdef __cplusplus 39 extern "C" { 40 # ifndef __THROW 41 # define __THROW throw () 42 # endif 43 #else 44 # ifndef __THROW 45 # define __THROW 46 # endif 47 #endif 48 49 typedef int pthread_once_t; 50 typedef unsigned int pthread_key_t; 51 52 /* This must be layout-compatible with the linuxthreads type. */ 53 typedef struct 54 { 55 int a, b; 56 void *c; 57 int d; 58 struct { long int e; int f; } g; 59 } pthread_mutex_t; 60 61 /* This give bits equal to the linuxthreads initializer. */ 62 #define PTHREAD_MUTEX_INITIALIZER \ 63 {0, 0, 0, 0, {0, 0}} 64 65 #define PTHREAD_ONCE_INIT 0 66 67 /* This isn't the right prototype, but it let's us get away with not 68 defining a lot of datatypes. */ 69 extern int pthread_create (void) __THROW; 70 71 extern int pthread_once (pthread_once_t *, void (*) (void)) __THROW; 72 73 extern int pthread_key_create (pthread_key_t *, void (*) (void *)) __THROW; 74 75 extern int pthread_setspecific (pthread_key_t, const void *) __THROW; 76 77 extern void *pthread_getspecific (pthread_key_t) __THROW; 78 79 extern int pthread_mutex_lock (pthread_mutex_t *) __THROW; 80 81 extern int pthread_key_delete (pthread_key_t) __THROW; 82 83 extern int pthread_mutex_trylock (pthread_mutex_t *) __THROW; 84 85 extern int pthread_mutex_unlock (pthread_mutex_t *) __THROW; 86 87 #ifdef __cplusplus 88 } 89 #endif 90 91 #undef __THROW 92 93 #endif /* not _PTHREAD_FAKE */ 94