From d2b870cd9b6d91261a304e156819571acc309b55 Mon Sep 17 00:00:00 2001 From: rpj Date: Sat, 23 Feb 2002 02:01:11 +0000 Subject: * pthread_cond_destroy.c: Expand the time change critical section to solve deadlock problem. * pthread.c: Add all remaining C modules. * pthread.h: Use dllexport/dllimport attributes on functions to avoid using pthread.def. * sched.h: Likewise. * semaphore.h: Likewise. * GNUmakefile: Add new targets for single translation unit build to maximise inlining potential; generate pthread.def automatically. * Makefile: Likewise, but no longer uses pthread.def. --- semaphore.h | 111 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 47 deletions(-) (limited to 'semaphore.h') diff --git a/semaphore.h b/semaphore.h index 78a627c..2956066 100644 --- a/semaphore.h +++ b/semaphore.h @@ -2,39 +2,39 @@ * Module: semaphore.h * * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: + * Semaphores aren't actually part of the PThreads standard. + * They are defined by the POSIX Standard: * - * POSIX 1003.1b-1993 (POSIX.1b) + * POSIX 1003.1b-1993 (POSIX.1b) * * -------------------------------------------------------------------------- * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2002 Pthreads-win32 contributors + * Pthreads-win32 - POSIX Threads Library for Win32 + * Copyright(C) 1998 John E. Bossom + * Copyright(C) 1999,2002 Pthreads-win32 contributors * - * Contact Email: rpj@ise.canberra.edu.au + * Contact Email: rpj@ise.canberra.edu.au * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html + * The current list of contributors is contained + * in the file CONTRIBUTORS included with the source + * code distribution. The list can also be seen at the + * following World Wide Web location: + * http://sources.redhat.com/pthreads-win32/contributors.html * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING.LIB; + * if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined( SEMAPHORE_H ) #define SEMAPHORE_H @@ -65,6 +65,23 @@ /* Include everything */ #endif +#if __GNUC__ && ! defined (__declspec) +# error Please upgrade your GNU compiler to one that supports __declspec. +#endif + +/* + * When building the DLL code, you should define PTW32_BUILD so that + * the variables/functions are exported correctly. When using the DLL, + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ +#ifdef PTW32_BUILD +# define PTW32_DLLPORT __declspec (dllexport) +#else +# define PTW32_DLLPORT __declspec (dllimport) +#endif + + /* * This is a duplicate of what is in the autoconf config.h, * which is only used when building the pthread-win32 libraries. @@ -97,7 +114,7 @@ #ifdef __cplusplus extern "C" { -#endif /* __cplusplus */ +#endif /* __cplusplus */ #ifndef HAVE_MODE_T typedef unsigned int mode_t; @@ -106,41 +123,41 @@ typedef unsigned int mode_t; typedef struct sem_t_ * sem_t; -int sem_init (sem_t * sem, - int pshared, - unsigned int value); +PTW32_DLLPORT int sem_init (sem_t * sem, + int pshared, + unsigned int value); -int sem_destroy (sem_t * sem); +PTW32_DLLPORT int sem_destroy (sem_t * sem); -int sem_trywait (sem_t * sem); +PTW32_DLLPORT int sem_trywait (sem_t * sem); -int sem_wait (sem_t * sem); +PTW32_DLLPORT int sem_wait (sem_t * sem); -int sem_timedwait (sem_t * sem, - const struct timespec * abstime); +PTW32_DLLPORT int sem_timedwait (sem_t * sem, + const struct timespec * abstime); -int sem_post (sem_t * sem); +PTW32_DLLPORT int sem_post (sem_t * sem); -int sem_post_multiple (sem_t * sem, - int count); +PTW32_DLLPORT int sem_post_multiple (sem_t * sem, + int count); -int sem_open (const char * name, - int oflag, - mode_t mode, - unsigned int value); +PTW32_DLLPORT int sem_open (const char * name, + int oflag, + mode_t mode, + unsigned int value); -int sem_close (sem_t * sem); +PTW32_DLLPORT int sem_close (sem_t * sem); -int sem_unlink (const char * name); +PTW32_DLLPORT int sem_unlink (const char * name); -int sem_getvalue (sem_t * sem, - int * sval); +PTW32_DLLPORT int sem_getvalue (sem_t * sem, + int * sval); #ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ +} /* End of extern "C" */ +#endif /* __cplusplus */ #undef PTW32_LEVEL #undef PTW32_LEVEL_MAX -#endif /* !SEMAPHORE_H */ +#endif /* !SEMAPHORE_H */ -- cgit v1.2.3