diff options
author | rpj <rpj> | 2005-04-01 01:28:29 +0000 |
---|---|---|
committer | rpj <rpj> | 2005-04-01 01:28:29 +0000 |
commit | f6f9976af7a520dd1aeced4f104f4d4711f28e23 (patch) | |
tree | 1a4e65f32d585c114af33772adfaa1995ffcf093 | |
parent | 25e5c566c5b050a04fc03851895f72750f016e4e (diff) |
''
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | dll.c | 4 | ||||
-rw-r--r-- | implement.h | 6 | ||||
-rw-r--r-- | pthread.h | 8 | ||||
-rw-r--r-- | sched.h | 10 | ||||
-rw-r--r-- | sem_timedwait.c | 22 | ||||
-rw-r--r-- | semaphore.h | 11 |
7 files changed, 54 insertions, 21 deletions
@@ -1,3 +1,17 @@ +2005-04-01 Kevin Lussier <Kevin at codegreennetworks.com> + + * sem_timedwait.c (sem_timedwait): Increase size of temp variables to + avoid int overflows for large timeout values. + * implement.h (int64_t): Include or define. + +2005-03-31 Dimitar Panayotov <develop at mail.bg>^M + + * pthread.h: Fix conditional defines for static linking. + * sched.h: Liekwise. + * semaphore.h: Likewise. + * dll.c (PTW32_STATIC_LIB): Module is conditionally included + in the build. + 2005-03-16 Ross Johnson <ross at callisto.canberra.edu.au>
* pthread_setcancelstate.c: Undo the last change. @@ -34,6 +34,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +#ifndef PTW32_STATIC_LIB + #include "pthread.h" #include "implement.h" @@ -86,3 +88,5 @@ DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) return (result); } /* DllMain */ + +#endif /* PTW32_STATIC_LIB */ diff --git a/implement.h b/implement.h index 69a70c6..286cd68 100644 --- a/implement.h +++ b/implement.h @@ -90,6 +90,12 @@ typedef VOID (APIENTRY *PAPCFUNC)(DWORD dwParam); #define PTW32_INTERLOCKED_LPLONG PVOID* #endif +#if defined(__MINGW32__) +#include <stdint.h> +#else +#define int64_t _int64 +#endif + typedef enum { /* @@ -37,8 +37,8 @@ * See the README file for an explanation of the pthreads-win32 version * numbering scheme and how the DLL is named etc. */ -#define PTW32_VERSION 1,5,0,0 -#define PTW32_VERSION_STRING "1, 5, 0, 0\0" +#define PTW32_VERSION 1,6,0,0 +#define PTW32_VERSION_STRING "1, 6, 0, 0\0" /* There are three implementations of cancel cleanup. * Note that pthread.h is included in both application @@ -556,12 +556,14 @@ extern "C" * do NOT define PTW32_BUILD, and then the variables/functions will * be imported correctly. */ -#ifdef _DLL +#ifndef PTW32_STATIC_LIB # ifdef PTW32_BUILD # define PTW32_DLLPORT __declspec (dllexport) # else # define PTW32_DLLPORT __declspec (dllimport) # endif +#else +# define PTW32_DLLPORT #endif /* @@ -76,10 +76,14 @@ * do NOT define PTW32_BUILD, and then the variables/functions will * be imported correctly. */ -#ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) +#ifndef PTW32_STATIC_LIB +# ifdef PTW32_BUILD +# define PTW32_DLLPORT __declspec (dllexport) +# else +# define PTW32_DLLPORT __declspec (dllimport) +# endif #else -# define PTW32_DLLPORT __declspec (dllimport) +# define PTW32_DLLPORT #endif /* diff --git a/sem_timedwait.c b/sem_timedwait.c index 6bf94d4..7fba45f 100644 --- a/sem_timedwait.c +++ b/sem_timedwait.c @@ -121,11 +121,11 @@ sem_timedwait (sem_t * sem, const struct timespec *abstime) #endif /* NEED_FTIME */ - const DWORD NANOSEC_PER_MILLISEC = 1000000; - const DWORD MILLISEC_PER_SEC = 1000; + const int64_t NANOSEC_PER_MILLISEC = 1000000; + const int64_t MILLISEC_PER_SEC = 1000; DWORD milliseconds; - DWORD tmpAbsMilliseconds; - DWORD tmpCurrMilliseconds; + int64_t tmpAbsMilliseconds; + int64_t tmpCurrMilliseconds; if (sem == NULL) { @@ -150,8 +150,8 @@ sem_timedwait (sem_t * sem, const struct timespec *abstime) * * Assume all integers are unsigned, i.e. cannot test if less than 0. */ - tmpAbsMilliseconds = abstime->tv_sec * MILLISEC_PER_SEC; - tmpAbsMilliseconds += (abstime->tv_nsec + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC; + tmpAbsMilliseconds = (int64_t)abstime->tv_sec * MILLISEC_PER_SEC; + tmpAbsMilliseconds += ((int64_t)abstime->tv_nsec + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC; /* get current system time */ @@ -171,21 +171,21 @@ sem_timedwait (sem_t * sem, const struct timespec *abstime) ptw32_filetime_to_timespec(&ft, &currSysTime); } - tmpCurrMilliseconds = currSysTime.tv_sec * MILLISEC_PER_SEC; - tmpCurrMilliseconds += (currSysTime.tv_nsec + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC; + tmpCurrMilliseconds = (int64_t)currSysTime.tv_sec * MILLISEC_PER_SEC; + tmpCurrMilliseconds += ((int64_t)currSysTime.tv_nsec + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC; #else /* ! NEED_FTIME */ _ftime(&currSysTime); - tmpCurrMilliseconds = (DWORD) currSysTime.time * MILLISEC_PER_SEC; - tmpCurrMilliseconds += (DWORD) currSysTime.millitm; + tmpCurrMilliseconds = (int64_t) currSysTime.time * MILLISEC_PER_SEC; + tmpCurrMilliseconds += (int64_t) currSysTime.millitm; #endif /* NEED_FTIME */ if (tmpAbsMilliseconds > tmpCurrMilliseconds) { - milliseconds = tmpAbsMilliseconds - tmpCurrMilliseconds; + milliseconds = (DWORD) (tmpAbsMilliseconds - tmpCurrMilliseconds); if (milliseconds == INFINITE) { /* Timeouts must be finite */ diff --git a/semaphore.h b/semaphore.h index 7e71089..a3330a6 100644 --- a/semaphore.h +++ b/semaphore.h @@ -75,13 +75,16 @@ * do NOT define PTW32_BUILD, and then the variables/functions will * be imported correctly. */ -#ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) +#ifndef PTW32_STATIC_LIB +# ifdef PTW32_BUILD +# define PTW32_DLLPORT __declspec (dllexport) +# else +# define PTW32_DLLPORT __declspec (dllimport) +# endif #else -# define PTW32_DLLPORT __declspec (dllimport) +# define PTW32_DLLPORT #endif - /* * This is a duplicate of what is in the autoconf config.h, * which is only used when building the pthread-win32 libraries. |