Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pthread_cond_init.c: Whitespace.
|
|
|
|
conditional compilation; refinements; bug fixes. See the ChangeLog.
|
|
* 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.
|
|
ptw32_interlocked_compare_exchange function pointer
rather than ptw32_InterlockedCompareExchange() directly
to retain portability to non-iX86 processors,
e.g. WinCE etc. The pointer will point to the native
OS version of InterlockedCompareExchange() if the
OS supports it (see ChangeLog entry of 2001-10-17).
|
|
section calls.
(pthread_mutex_destroy): Likewise.
(pthread_mutex_unlock): Likewise.
(pthread_mutex_trylock): Likewise; recursive mutexes
now increment the lock count rather than return EBUSY;
errorcheck mutexes return EDEADLCK rather than
EBUSY. This behaviour is consistent with the Solaris
pthreads implementation.
* implement.h (pthread_mutex_t_): Remove critical
section element - no longer needed.
|
|
checking and actually store the scope value even
though it's not really necessary.
(pthread_attr_getscope): Return stored value.
* implement.h (pthread_attr_t_): Add new scope element.
* ANNOUNCE: Fix out of date comment next to
pthread_attr_setscope in conformance section.
|
|
Remove unused autoconf files;
Add the file COPYING, which describes the pthread-win32 license
relative to the FSF LGPL.
|
|
WSAGetLastError() and WSASetLastError().
* Makefile (wsock32.lib): Likewise.
* create.c: Minor mostly inert changes.
* implement.h (PTW32_MAX): Move into here and renamed
from sched.h.
(PTW32_MIN): Likewise.
* GNUmakefile (TEST_ICE): Define if testing internal
implementation of InterlockedCompareExchange.
* Makefile (TEST_ICE): Likewise.
* private.c (TEST_ICE): Likewise.
|
|
implement.h; rename to PTW32_INTERLOCKED_LONG and
PTW32_INTERLOCKED_LPLONG respectively.
* spin.c: Likewise; ptw32_interlocked_compare_exchange used
in place of InterlockedCompareExchange directly.
* global.c (ptw32_interlocked_compare_exchange): Add
prototype for this new routine pointer to be used when
InterlockedCompareExchange isn't supported by Windows.
* nonportable.c (pthread_win32_process_attach_np): Check for
support of InterlockedCompareExchange in kernel32 and assign its
address to ptw32_interlocked_compare_exchange if it exists, or
our own ix86 specific implementation ptw32_InterlockedCompareExchange.
*private.c (ptw32_InterlockedCompareExchange): An
implementation of InterlockedCompareExchange() which is
specific to ix86; written directly in assembler for either
MSVC or GNU C; needed because Windows 95 doesn't support
InterlockedCompareExchange().
* sched.c (sched_get_priority_min): Extend to return
THREAD_PRIORITY_IDLE.
(sched_get_priority_max): Extend to return
THREAD_PRIORITY_CRITICAL.
|
|
that is no longer used.
* implement.h: Likewise.
|
|
* barrier.c: Still more revamping. The exclusive access
mutex isn't really needed so it has been removed and replaced
by an InterlockedDecrement(). nSerial has been removed.
iStep is now dual-purpose. The process shared attribute
is now stored in the barrier struct.
* implement.h (pthread_barrier_t_): Lost some/gained one
elements.
* private.c (ptw32_threadStart): Removed some comments.
|
|
semaphores are used instead of the PulseEvent. Also improved
overall throughput by returning PTHREAD_BARRIER_SERIAL_THREAD
to the first waking thread.
* implement.h (pthread_barrier_t_): Revamped.
|
|
* barrier.c: Fix several bugs in all routines. Now passes
tests/barrier5.c which is fairly rigorous. There is still
a non-optimal work-around for a race condition between
the barrier breeched event signal and event wait. Basically
the last (signalling) thread to hit the barrier yields
to allow any other threads, which may have lost the race,
to complete.
tests/ChangeLog:
* barrier3.c: Fixed.
* barrier4.c: Fixed.
* barrier5.c: New; proves that all threads in the group
reaching the barrier wait and then resume together. Repeats
the test using groups of 1 to 16 threads. Each group of
threads must negotiate a large number of barriers (10000).
* spin4.c: Fixed.
* test.h (error_string): Modified the success (0) value.
|
|
* spin.c: Revamped and working; included static initialiser.
* barrier.c: Likewise.
* condvar.c: Macro constant change; inline auto init routine.
* mutex.c: Likewise.
* rwlock.c: Likewise.
* private.c: Add support for spinlock initialiser.
* global.c: Likewise.
* implement.h: Likewise.
* pthread.h (PTHREAD_SPINLOCK_INITIALIZER): Fix typo.
tests/ChangeLog:
* spin3.c: Changed test and fixed.
* spin4.c: Fixed.
* barrier3.c: Fixed.
* barrier4.c: Fixed.
|
|
|
|
* spin.c: New module implementing spin locks.
* barrier.c: New module implementing barriers.
* pthread.h (_POSIX_SPIN_LOCKS): defined.
(_POSIX_BARRIERS): Defined.
(pthread_spin_*): Defined.
(pthread_barrier*): Defined.
(PTHREAD_BARRIER_SERIAL_THREAD): Defined.
* implement.h (pthread_spinlock_t_): Defined.
(pthread_barrier_t_): Defined.
(pthread_barrierattr_t_): Defined.
* mutex.c (pthread_mutex_lock): Return with the error
if an auto-initialiser initialisation fails.
* nonportable.c (pthread_getprocessors_np): New; gets the
number of available processors for the current process.
|
|
* create.c (pthread_create): Add priority inheritance
attributes.
* mutex.c (pthread_mutex_lock): Remove some overhead for
PTHREAD_MUTEX_NORMAL mutex types. Specifically, avoid
calling pthread_self() and pthread_equal() to check/set
the mutex owner. Introduce a new pseudo owner for this
type. Test results suggest increases in speed of up to
90% for non-blocking locks.
This is the default type of mutex used internally by other
synchronising objects, ie. condition variables and
read-write locks. The test rwlock7.c shows about a
30-35% speed increase over snapshot 2001-06-06. The
price of this is that the application developer
must ensure correct behaviour, or explicitly set the
mutex to a safer type such as PTHREAD_MUTEX_ERRORCHECK.
For example, PTHREAD_MUTEX_NORMAL (or PTHREAD_MUTEX_DEFAULT)
type mutexes will not return an error if a thread which is not
the owner calls pthread_mutex_unlock. The call will succeed
in unlocking the mutex if it is currently locked, but a
subsequent unlock by the true owner will then fail with EPERM.
This is however consistent with some other implementations.
(pthread_mutex_unlock): Likewise.
(pthread_mutex_trylock): Likewise.
(pthread_mutex_destroy): Likewise.
* attr.c (pthread_attr_init): PTHREAD_EXPLICIT_SCHED is the
default inheritance attribute; THREAD_PRIORITY_NORMAL is
the default priority for new threads.
* sched.c (pthread_attr_setschedpolicy): Added routine.
(pthread_attr_getschedpolicy): Added routine.
(pthread_attr_setinheritsched): Added routine.
(pthread_attr_getinheritsched): Added routine.
* pthread.h (sched_rr_set_interval): Added as a macro;
returns -1 with errno set to ENOSYS.
2001-06-23 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
*sched.c (pthread_attr_setschedparam): Add priority range
check.
(sched_setscheduler): New function; checks for a valid
pid and policy; checks for permission to set information
in the target process; expects pid to be a Win32 process ID,
not a process handle; the only scheduler policy allowed is
SCHED_OTHER.
(sched_getscheduler): Likewise, but checks for permission
to query.
* pthread.h (SCHED_*): Moved to sched.h as defined in the
POSIX standard.
* sched.h (SCHED_*): Moved from pthread.h.
(pid_t): Defined if necessary.
(sched_setscheduler): Defined.
(sched_getscheduler): Defined.
* pthread.def (sched_setscheduler): Exported.
(sched_getscheduler): Likewise.
2001-06-23 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
Contributed by - Ralf Brese <Ralf.Brese@pdb4.siemens.de>
* create.c (pthread_create): Set thread priority from
thread attributes.
|
|
* dll.c (dllMain): Moved UWIN process attach code
to pthread_win32_process_attach_np(); moved
instance of pthread_count to global.c.
* global.c (pthread_count): Moved from dll.c.
* nonportable.c (pthread_win32_process_attach_np):
Moved _UWIN code to here from dll.c.
* implement.h (pthread_count): Define extern int.
* create.c (pthread_count): Remove extern int.
* private.c (pthread_count): Likewise.
* exit.c (pthread_count): Likewise.
Contributed by - David Korn <dgk@research.att.com>
* dll.c: Added changes necessary to work with UWIN.
* create.c: Likewise.
* pthread.h: Likewise.
* misc.c: Likewise.
* exit.c: Likewise.
* private.c: Likewise.
* implement.h: Likewise.
There is some room at the start of struct pthread_t_
to implement the signal semantics in UWIN's posix.dll
although this is not yet complete.
* Nmakefile: Compatible with UWIN's Nmake utility.
* Nmakefile.tests: Likewise - for running the tests.
|
|
* implement.h (sem_t_): Likewise.
* semaphore.c: Likewise.
* private.c (ptw32_sem_timedwait): Updated to use new
opaque sem_t.
tests/
* mutex5.c: Insert inert change to quell compiler warnings.
* condvar3_2.c: Remove unused variable.
|
|
moved actual definition to implement.h.
* implement.h (sem_t_): Move here from semaphore.h;
was the definition of sem_t.
* semaphore.c: Wherever necessary, changed use of sem
from that of a pointer to a pointer-pointer; added
extra checks for a valid sem_t; NULL sem_t when
it is destroyed; added extra checks when creating
and destroying sem_t elements in the NEED_SEM
code branches; changed from using a pthread_mutex_t
((*sem)->mutex) to CRITICAL_SECTION ((*sem)->sem_lock_cs)
in NEED_SEM branches for access serialisation.
|
|
2001-06-03 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
Contributed by - Alexander Terekhov <TEREKHOV@de.ibm.com>
- Louis Thomas <lthomas@arbitrade.com>
* condvar.c (pthread_cond_init): Completely revamped.
(pthread_cond_destroy): Likewise.
(ptw32_cond_wait_cleanup): Likewise.
(ptw32_cond_timedwait): Likewise.
(ptw32_cond_unblock): New general signaling routine.
(pthread_cond_signal): Now calls ptw32_cond_unblock.
(pthread_cond_broadcast): Likewise.
* implement.h (pthread_cond_t_): Revamped.
* README.CV: New; explanation of the above changes.
pthreads/tests:
2001-06-3 Ross Johnson <rpj@special.ise.canberra.edu.au>
* condvar2_1.c: New test.
* condvar3_1.c: New test.
* condvar3_2.c: New test.
|
|
* pthread.h (rand_r): Fake using _seed argument to quell
compiler warning (compiler should optimise this away later).
* GNUmakefile (OPT): Leave symbolic information out of the library
and increase optimisation level - for smaller faster prebuilt
dlls.
2001-05-29 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
Contributed by - Milan Gardian <Milan.Gardian@LEIBINGER.com>
* Makefile: fix typo.
* pthreads.h: Fix problems with stdcall/cdecl conventions, in particular
remove the need for PT_STDCALL everywhere; remove warning supression.
* (errno): Fix the longstanding "inconsistent dll linkage" problem
with errno; now also works with /MD debugging libs -
warnings emerged when compiling pthreads library with /MD (or /MDd)
compiler switch, instead of /MT (or /MTd) (i.e. when compiling pthreads
using Multithreaded DLL CRT instead of Multithreaded statically linked
CRT).
* create.c (pthread_create): Likewise; fix typo.
* private.c (ptw32_threadStart): Eliminate use of terminate() which doesn't
throw exceptions.
* Remove unnecessary #includes from a number of modules -
[I had to #include malloc.h in implement.h for gcc - rpj].
2001-05-29 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
Contributed by - Thomas Pfaff <tpfaff@gmx.net>
* pthread.h (PTHREAD_MUTEX_DEFAULT): New; equivalent to
PTHREAD_MUTEX_DEFAULT_NP.
* (PTHREAD_MUTEX_NORMAL): Similarly.
* (PTHREAD_MUTEX_ERRORCHECK): Similarly.
* (PTHREAD_MUTEX_RECURSIVE): Similarly.
* (pthread_mutex_setdefaultkind_np): New; Linux compatibility stub
for pthread_mutexattr_settype.
* (pthread_mutexattr_getkind_np): New; Linux compatibility stub
for pthread_mutexattr_gettype.
* mutex.c (pthread_mutexattr_settype): New; allow
the following types of mutex:
PTHREAD_MUTEX_DEFAULT_NP
PTHREAD_MUTEX_NORMAL_NP
PTHREAD_MUTEX_ERRORCHECK_NP
PTHREAD_MUTEX_RECURSIVE_NP
* Note that PTHREAD_MUTEX_DEFAULT is equivalent to
PTHREAD_MUTEX_NORMAL - ie. mutexes should no longer
be recursive by default, and a thread will deadlock if it
tries to relock a mutex it already owns. This is inline with
other pthreads implementations.
* (pthread_mutex_lock): Process the lock request
according to the mutex type.
* (pthread_mutex_init): Eliminate use of Win32 mutexes as the
basis of POSIX mutexes - instead, a combination of one critical section
and one semaphore are used in conjunction with Win32 Interlocked* routines.
* (pthread_mutex_destroy): Likewise.
* (pthread_mutex_lock): Likewise.
* (pthread_mutex_trylock): Likewise.
* (pthread_mutex_unlock): Likewise.
* Use longjmp/setjmp to implement cancelation when building the library
using a C compiler which doesn't support exceptions, e.g. gcc -x c (note
that gcc -x c++ uses exceptions).
* Also fixed some of the same typos and eliminated PT_STDCALL as
Milan Gardian's patches above.
2001-02-07 Ross Johnson <rpj@special.ise.canberra.edu.au>
Contributed by - Alexander Terekhov <TEREKHOV@de.ibm.com>
* rwlock.c: Revamped.
* implement.h (pthread_rwlock_t_): Redefined.
This implementation does not have reader/writer starvation problem.
Rwlock attempts to behave more like a normal mutex with
races and scheduling policy determining who is more important;
It also supports recursive locking,
has less synchronization overhead (no broadcasts at all,
readers are not blocked on any condition variable) and seem to
be faster than the current implementation [W98 appears to be
approximately 15 percent faster at least - on top of speed increase
from Thomas Pfaff's changes to mutex.c - rpj].
|