diff options
author | rpj <rpj> | 2002-01-31 06:56:03 +0000 |
---|---|---|
committer | rpj <rpj> | 2002-01-31 06:56:03 +0000 |
commit | 75f8ad67d45d48b9cdde5a298083881790c76c73 (patch) | |
tree | 0d793e00b40a3292f1fee2b302eb6eccdf15d113 /implement.h | |
parent | 30a1e9738593302fa26e0a668f517bc7f5800190 (diff) |
2002-01-27 Ross Johnson <rpj@special.ise.canberra.edu.au>
* mutex.c (pthread_mutex_timedlock): New function suggested by
Alexander Terekhov. The logic required to implement this
properly came from Alexander, with some collaboration
with Thomas Pfaff.
(pthread_mutex_unlock): Wrap the waiters check and sema
post in a critical section to prevent a race with
pthread_mutex_timedlock.
(ptw32_timed_semwait): New function;
returns a special result if the absolute timeout parameter
represents a time already passed when called; used by
pthread_mutex_timedwait(). Have deliberately not reused
the name "ptw32_sem_timedwait" because they are not the same
routine.
* condvar.c (ptw32_cond_timedwait): Use the new sem_timedwait()
instead of ptw32_sem_timedwait(), which now has a different
function. See previous.
* implement.h: Remove prototype for ptw32_sem_timedwait.
See next.
(pthread_mutex_t_): Add critical section element for access
to lock_idx during mutex post-timeout processing.
* semaphore.h (sem_timedwait): See next.
* semaphore.c (sem_timedwait): See next.
* private.c (ptw32_sem_timedwait): Move to semaphore.c
and rename as sem_timedwait().
2002-01-18 Ross Johnson <rpj@special.ise.canberra.edu.au>
* sync.c (pthread_join): Was getting the exit code from the
calling thread rather than the joined thread if
defined(__MINGW32__) && !defined(__MSVCRT__).
2002-01-15 Ross Johnson <rpj@special.ise.canberra.edu.au>
* pthread.h: Unless the build explicitly defines __CLEANUP_SEH,
__CLEANUP_CXX, or __CLEANUP_C, then the build defaults to
__CLEANUP_C style cleanup. This style uses setjmp/longjmp
in the cancelation and thread exit implementations and therefore
won't do stack unwinding if linked to applications that have it
(e.g. C++ apps). This is currently consistent with most/all
commercial Unix POSIX threads implementations.
* spin.c (pthread_spin_init): Edit renamed function call.
* nonportable.c (pthread_num_processors_np): New.
(pthread_getprocessors_np): Renamed to ptw32_getprocessors
and moved to private.c.
* private.c (pthread_getprocessors): Moved here from
nonportable.c.
* pthread.def (pthread_getprocessors_np): Removed
from export list.
* rwlock.c (pthread_rwlockattr_init): New.
(pthread_rwlockattr_destroy): New.
(pthread_rwlockattr_getpshared): New.
(pthread_rwlockattr_setpshared): New.
Diffstat (limited to 'implement.h')
-rw-r--r-- | implement.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/implement.h b/implement.h index e075ee9..1d2076b 100644 --- a/implement.h +++ b/implement.h @@ -30,6 +30,19 @@ #ifndef _IMPLEMENT_H #define _IMPLEMENT_H +/* + * note: ETIMEDOUT is correctly defined in winsock.h + */ +#include <windows.h> +#include <winsock.h> + +/* + * In case ETIMEDOUT hasn't been defined above somehow. + */ +#ifndef ETIMEDOUT +# define ETIMEDOUT 10060 /* This is the value in winsock.h. */ +#endif + #if !defined(malloc) #include <malloc.h> #endif @@ -165,8 +178,10 @@ struct pthread_mutex_t_ { mutexes only). */ int kind; /* Mutex type. */ pthread_t ownerThread; - HANDLE wait_sema; /* Mutex release notification to waiting + sem_t wait_sema; /* Mutex release notification to waiting threads. */ + CRITICAL_SECTION wait_cs; /* Serialise lock_idx decrement after mutex + timeout. */ }; struct pthread_mutexattr_t_ { @@ -451,6 +466,8 @@ void ptw32_pop_cleanup_all (int execute); pthread_t ptw32_new (void); +int ptw32_getprocessors(int * count); + #if ! defined (__MINGW32__) || defined (__MSVCRT__) unsigned __stdcall #else @@ -466,8 +483,6 @@ int ptw32_tkAssocCreate (ThreadKeyAssoc ** assocP, void ptw32_tkAssocDestroy (ThreadKeyAssoc * assoc); -int ptw32_sem_timedwait (sem_t * sem, - const struct timespec * abstime); #ifdef NEED_SEM void ptw32_decrease_semaphore(sem_t * sem); |