Age | Commit message (Collapse) | Author |
|
|
|
* 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.
|
|
* 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].
|
|
* rwlock.c (_rwlock_check*): Renamed to
ptw32_rwlock_check*.
* mutex.c (_mutex_check*): Renamed to ptw32_mutex_check*.
* condvar.c (cond_timed*): Renamed to ptw32_cond_timed*.
(_cond_check*): Renamed to ptw32_cond_check*.
|
|
* mutex.c (pthread_mutex_destroy): Check that the mutex isn't
held; invalidate the mutex as early as possible to avoid
contention; not perfect - FIXME!
* rwlock.c (pthread_rwlock_init): Remove redundant assignment
to "rw".
(pthread_rwlock_destroy): Invalidate the rwlock before
freeing up any of it's resources - to avoid contention.
* private.c (ptw32_tkAssocCreate): Change assoc->lock
to use a dynamically initialised mutex - only consumes
a W32 mutex or critical section when first used,
not before.
* mutex.c (pthread_mutex_init): Remove redundant assignment
to "mx".
(pthread_mutexattr_destroy): Set attribute to NULL
before freeing it's memory - to avoid contention.
|
|
* Several: Fix typos from scripted edit session
yesterday.
* nonportable.c (pthread_mutexattr_setforcecs_np):
Moved this function from mutex.c.
(pthread_getw32threadhandle_np): New function to
return the win32 thread handle that the POSIX
thread is using.
* mutex.c (pthread_mutexattr_setforcecs_np):
Moved to new file "nonportable.c".
* pthread.h (PTW32_BUILD): Only redefine __except
and catch compiler keywords if we aren't building
the library (ie. PTW32_BUILD is not defined) -
this is safer than defining and then undefining
if not building the library.
* implement.h: Remove __except and catch undefines.
* Makefile (CFLAGS): Define PTW32_BUILD.
* GNUmakefile (CFLAGS): Define PTW32_BUILD.
* All appropriate: Change Pthread_exception* to
ptw32_exception* to be consistent with internal
identifier naming.
* private.c (ptw32_throw): New function to provide
a generic exception throw for all internal
exceptions and EH schemes.
(ptw32_threadStart): pthread_exit() value is now
returned via the thread structure exitStatus
element.
* exit.c (pthread_exit): pthread_exit() value is now
returned via the thread structure exitStatus
element.
* cancel.c (ptw32_cancel_self): Now uses ptw32_throw.
(pthread_setcancelstate): Ditto.
(pthread_setcanceltype): Ditto.
(pthread_testcancel): Ditto.
(pthread_cancel): Ditto.
* misc.c (CancelableWait): Ditto.
* exit.c (pthread_exit): Ditto.
* All applicable: Change PTW32_ prefix to
PTW32_ prefix to remove leading underscores
from private library identifiers.
|
|
* All applicable: Change _pthread_ prefix to
ptw32_ prefix to remove leading underscores
from private library identifiers (single
and double leading underscores are reserved in the
ANSI C standard for compiler implementations).
|
|
* sched.c (sched_get_priority_max): Handle different WinCE and
Win32 priority values together.
(sched_get_priority_min): Ditto.
- Tristan Savatier <tristan@mpegtv.com>
* create.c (pthread_create): Force new threads to wait until
pthread_create has the new thread's handle; we also retain
a local copy of the handle for internal use until
pthread_create returns.
* private.c (_pthread_threadStart): Initialise ei[].
(_pthread_threadStart): When beginthread is used to start the
thread, force waiting until the creator thread had the
thread handle.
* cancel.c (_pthread_cancel_thread): Include context switch
code for defined(_X86_) environments in addition to _M_IX86.
* rwlock.c (pthread_rwlock_destroy): Assignment changed
to avoid compiler warning.
* private.c (_pthread_get_exception_services_code): Cast
NULL return value to avoid compiler warning.
* cleanup.c (pthread_pop_cleanup): Initialise "cleanup" variable
to avoid compiler warnings.
* misc.c (_pthread_new): Change "new" variable to "t" to avoid
confusion with the C++ keyword of the same name.
* condvar.c (cond_wait_cleanup): Initialise lastWaiter variable.
(cond_timedwait): Remove unused local variables. to avoid
compiler warnings.
* dll.c (dllMain): Remove 2000-07-21 change - problem
appears to be in pthread_create().
2000-07-22 Ross Johnson <rpj@special.ise.canberra.edu.au>
* tsd.c (pthread_key_create): If a destructor was given
and the pthread_mutex_init failed, then would try to
reference a NULL pointer (*key); eliminate this section of
code by using a dynamically initialised mutex
(PTHREAD_MUTEX_INITIALIZER).
* tsd.c (pthread_setspecific): Return an error if
unable to set the value; simplify cryptic conditional.
* tsd.c (pthread_key_delete): Locking threadsLock relied
on mutex_lock returning an error if the key has no destructor.
ThreadsLock is only initialised if the key has a destructor.
Making this mutex a static could reduce the number of mutexes
used by an application since it is actually created only at
first use and it's often destroyed soon after.
2000-07-22 Ross Johnson <rpj@special.ise.canberra.edu.au>
* FAQ: Added Q5 and Q6.
tests/ChangeLog:
2000-07-25 Ross Johnson <rpj@special.ise.canberra.edu.au>
* runtest.bat: modified to work under W98.
* runall.bat: Add new tests; modified to work under W98.
It was ok under NT.
* Makefile: Add new tests.
* exception1.c: New; Test passing exceptions back to the
application and retaining library internal exceptions.
* join0.c: New; Test a single join.
|
|
* rwlock.c (pthread_rwlock_destroy): Add cast to remove compile
warning.
* condvar.c (pthread_cond_broadcast): Only release semaphores
if there are waiting threads.
1999-10-15 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* condvar.c (cond_wait_cleanup): New static cleanup handler for
cond_timedwait;
(cond_timedwait): pthread_cleanup_push args changed;
canceling a thread while it's in pthread_cond_wait
will now decrement the waiters count and cleanup if it's the
last waiter.
- Lorin Hochstein <lmh@xiphos.ca> and
Peter Slacik <Peter.Slacik@tatramed.sk>;
the last waiter will now reset the CV's wasBroadcast flag
- Graham Dumpleton <Graham.Dumpleton@ra.pad.otc.telstra.com.au>.
|
|
* rwlock.c (pthread_rwlock_destroy): Add serialisation.
(_rwlock_check_need_init): Check for detroyed rwlock.
* rwlock.c: Check return codes from _rwlock_check_need_init();
modify comments; serialise access to rwlock objects during
operations; rename rw_mutex to rw_lock.
* implement.h: Rename rw_mutex to rw_lock.
* mutex.c (pthread_mutex_destroy): Add serialisation.
(_mutex_check_need_init): Check for detroyed mutex.
* condvar.c (pthread_cond_destroy): Add serialisation.
(_cond_check_need_init): Check for detroyed condvar.
* mutex.c: Modify comments.
* condvar.c: Modify comments.
|
|
The following code for POSIX read/write locks was contributed
by Aurelio Medina.
* implement.h (pthread_rwlock_t_): Add.
* pthread.h (pthread_rwlock_t): Add.
(PTHREAD_RWLOCK_INITIALIZER): Add.
Add rwlock function prototypes.
* rwlock.c: New module.
* pthread.def: Add new rwlock functions.
* private.c (_pthread_processInitialize): initialise
_pthread_rwlock_test_init_lock critical section.
* global.c (_pthread_rwlock_test_init_lock): Add.
* mutex.c (pthread_mutex_destroy): Don't free mutex memory
if mutex is PTHREAD_MUTEX_INITIALIZER and has not been
initialised yet.
tests/ChangeLog
Sep 15 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* rwlock1.c: New test.
* rwlock2.c: New test.
* rwlock3.c: New test.
* rwlock4.c: New test.
|