Age | Commit message (Collapse) | Author |
|
|
|
Contributed by - Alexander Terekhov.
* condvar.c: Fixed lost signal bug reported by Timur Aydin
(taydin@snet.net).
[RPJ (me) didn't translate the original algorithm
correctly.]
* semaphore.c: Added sem_post_multiple; this is a useful
routine, but it doesn't appear to be standard. For now it's
not an exported function.
|
|
* 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.
|
|
* 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.
|
|
ptw32_mutex_default_kind.
|
|
|
|
Remove - should not have been included in the first place.
(pthread_mutex_getdefaultkind_np): Likewise.
* global.c (ptw32_mutex_default_kind): Likewise.
* mutex.c (pthread_mutex_init): Remove use of
ptw32_mutex_default_kind.
* pthread.h (pthread_mutex_setdefaultkind_np): Likewise.
(pthread_mutex_getdefaultkind_np): Likewise.
* pthread.def (pthread_mutexattr_setkind_np): Added.
(pthread_mutexattr_getkind_np): Likewise.
* README: Many changes that should have gone in before
the last snapshot.
* README.NONPORTABLE: New - referred to by ANNOUNCE
but never created; documents the non-portable routines
included in the library - moved from README with new
routines added.
* ANNOUNCE (pthread_mutexattr_setkind_np): Added to
compliance list.
(pthread_mutexattr_getkind_np): Likewise.
|
|
|
|
|
|
* 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].
|
|
|
|
|
|
|
|
* cancel.c (pthread_cancel): Must get "self" through
calling pthread_self() which will ensure a POSIX thread
struct is built for non-POSIX threads; return an error
if this fails
- Ollie Leahy <ollie@mpt.ie>
(pthread_setcancelstate): Likewise.
(pthread_setcanceltype): Likewise.
* misc.c (ptw32_cancelable_wait): Likewise.
* private.c (ptw32_tkAssocCreate): Remove unused #if 0
wrapped code.
* pthread.h (ptw32_get_exception_services_code):
Needed to be forward declared unconditionally.
2000-09-06 Ross Johnson <rpj@special.ise.canberra.edu.au>
* cancel.c (pthread_cancel): If called from the main
thread "self" would be NULL; get "self" via pthread_self()
instead of directly from TLS so that an implicit
pthread object is created.
* misc.c (pthread_equal): Strengthen test for NULLs.
|
|
* 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).
|
|
* errno.c: Add _MD precompile condition; thus far
had no effect when using /MD compile option but I
thnk it should be there.
* exit.c: Add __cplusplus to various #if lines;
was compiling SEH code even when VC++ had
C++ compile options.
* private.c: ditto.
* create.c (pthread_create): Add PT_STDCALL macro to
function pointer arg in _beginthread().
* pthread.h: PT_STDCALL really does need to be defined
in both this and impliment.h; don't set it to __cdecl
- this macro is only used to extend function pointer
casting for functions that will be passed as parameters.
(~PThreadCleanup): add cast and group expression.
(_errno): Add _MD compile conditional.
(PtW32NoCatchWarn): Change pragma message.
* implement.h: Move and change PT_STDCALL define.
* need_errno.h: Add _MD to compilation conditional.
* GNUmakefile: Substantial rewrite for new naming
convention; set for nil optimisation (turn it up
when we have a working library build; add target
"fake.a" to build a libpthreadw32.a from the VC++
built DLL pthreadVCE.dll.
* pthread.def (LIBRARY): Don't specify in the .def
file - it is specified on the linker command line
since we now use the same .def file for variously
named .dlls.
* Makefile: Substantial rewrite for new naming
convention; default nmake target only issues a
help message; run nmake with specific target
corresponding to the EH scheme being used.
* README: Update information; add naming convention
explanation.
* ANNOUNCE: Update information.
2000-08-12 Ross Johnson <rpj@special.ise.canberra.edu.au>
* pthread.h: Add compile-time message when using
MSC_VER compiler and C++ EH to warn application
programmers to use PtW32Catch instead of catch(...)
if they want cancelation and pthread_exit to work.
* implement.h: Remove #include <semaphore.h>; we
use our own local semaphore.h.
tests/ChangeLog:
2000-08-13 Ross Johnson <rpj@special.ise.canberra.edu.au>
* condvar3.c: Minor change to eliminate compiler
warning.
* condvar4.c: ditto.
* condvar5.c: ditto.
* condvar6.c: ditto.
* condvar7.c: ditto.
* condvar8.c: ditto.
* condvar9.c: ditto.
* exit1.c: Function needed return statement.
* cleanup1.c: Remove unnecessary printf arg.
* cleanup2.c: Fix cast.
* rwlock6.c: Fix casts.
* exception1.c (PtW32CatchAll): Had the wrong name;
fix casts.
* cancel3.c: Remove unused waitLock variable.
* GNUmakefile: Change library/dll naming; add new tests;
general minor changes.
* Makefile: Change library/dll naming; add targets for
testing each of the two VC++ EH scheme versions;
default target now issues help message; compile warnings
now interpreted as errors to stop the make; add new
tests; restructure to remove prerequisites needed
otherwise.
* README: Updated.
|
|
* cleanup.c (pthread_pop_cleanup): Remove _pthread
prefix from __except and catch keywords; implement.h
now simply undefines _pthread__except and
_pthread_catch if defined; VC++ was not textually
substituting _pthread_catch etc back to catch as
it was redefined; the reason for using the prefixed
version was to make it clear that it was not using
the pthread.h redefined catch keyword.
* private.c (_pthread_threadStart): Ditto.
(_pthread_callUserDestroyRoutines): Ditto.
* implement.h (_pthread__except): Remove #define.
(_pthread_catch): Remove #define.
* GNUmakefile (pthread.a): New target to build
libpthread32.a from pthread.dll using dlltool.
* buildlib.bat: Duplicate cl commands with args to
build C++ EH version of pthread.dll; use of .bat
files is redundant now that nmake compatible
Makefile is included; used as a kludge only now.
* Makefile: Localise some macros and fix up the clean:
target to extend it and work properly.
* CONTRIBUTORS: Add contributors.
* ANNOUNCE: Updated.
* README: Updated.
tests/ChangeLog:
2000-08-10 Ross Johnson <rpj@special.ise.canberra.edu.au>
* eyal1.c (main): Change implicit cast to explicit
cast when passing "print_server" function pointer;
G++ no longer allows implicit func parameter casts.
* cleanup1.c: Remove unused "waitLock".
(main): Fix implicit parameter cast.
* cancel2.c (main): Fix implicit parameter cast.
* cancel4.c (main): Fix implicit parameter cast.
* cancel3.c (main): Fix implicit parameter cast.
* GNUmakefile: Renamed from Makefile; Add missing
cancel1 and cancel2 test targets.
* Makefile: Converted for use with MS nmake.
|
|
* dll.c (dllMain): Remove 2000-07-21 change - problem
appears to be in pthread_create().
2000-07-21 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
* create.c (pthread_create): Set threadH to 0 (zero)
everywhere. Some assignments were using NULL. Maybe
it should be NULL everywhere - need to check. (I know
they are nearly always the same thing - but not by
definition.)
* dll.c: Include resource leakage work-around. This is a
partial FIXME which doesn't stop all leakage. The real
problem needs to be found and fixed.
- "David Baggett" <dmb@itasoftware.com>
* misc.c (pthread_self): Try to catch NULL thread handles
at the point where they might be generated, even though
they should always be valid at this point.
* tsd.c (pthread_setspecific): return an error value if
pthread_self() returns NULL.
* sync.c (pthread_join): return an error value if
pthread_self() returns NULL.
* signal.c (pthread_sigmask): return an error value if
pthread_self() returns NULL.
|
|
|
|
|
|
|
|
|
|
1999-10-30 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* create.c (pthread_create): Explicitly initialise thread state to
default values.
* cancel.c (pthread_setcancelstate): Check for NULL 'oldstate'
for compatibility with Solaris pthreads;
(pthread_setcanceltype): ditto:
- Erik Hensema <erik.hensema@group2000.nl>
1999-10-23 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* pthread.h (ctime_r): Fix incorrect argument "_tm"
- Erik Hensema <erik.hensema@group2000.nl>
tests/ChangeLog:
1999-10-30 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* cancel1.c: New. Test pthread_setcancelstate and
pthread_setcanceltype functions.
* eyal1.c (waste_time): Change calculation to avoid FP exception
on Aplhas
- Rich Peters <rpeters@micro-magic.com>
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
Sat May 8 09:42:30 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* pthread.def (sem_open): Add.
(sem_close): Add.
(sem_unlink): Add.
(sem_getvalue): Add.
* FAQ (Question 3): Add.
Thu Apr 8 01:16:23 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* semaphore.c (sem_open): New function; returns an error (ENOSYS).
(sem_close): ditto.
(sem_unlink): ditto.
(sem_getvalue): ditto.
* semaphore.h (_POSIX_SEMAPHORES): define.
./tests/ChangeLog
Sat May 29 23:29:04 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* runall.bat (condvar5): Add new test.
* runall.bat (condvar6): Add new test.
* Makefile (condvar5) : Add new test.
* Makefile (condvar6) : Add new test.
* condvar5.c: New test for pthread_cond_broadcast().
* condvar6.c: New test for pthread_cond_broadcast().
|
|
|
|
* *.c (comments): Remove individual attributions - these are
documented sufficiently elsewhere.
* implement.h (pthread.h): Remove extraneous include.
|
|
Sun Apr 4 11:05:57 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* sched.c (sched.h): Include.
* sched.h: New file for POSIX 1b scheduling.
* pthread.h: Move opaque structures to implement.h; move sched_*
prototypes out and into sched.h.
* implement.h: Add opaque structures from pthread.h.
* sched.c (sched_yield): New function.
* condvar.c (_pthread_sem_*): Rename to sem_*; except for
_pthread_sem_timedwait which is an private function.
Sat Apr 3 23:28:00 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* Makefile.in (OBJS): Add errno.o.
Fri Apr 2 11:08:50 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* implement.h (_pthread_sem_*): Remove prototypes now defined in
semaphore.h.
* pthread.h (sempahore.h): Include.
* semaphore.h: New file for POSIX 1b semaphores.
* pthread.h (_pthread_sem_t): Change to sem_t.
* semaphore.c (_pthread_sem_*): Change to sem_*; these functions
will be exported from the library; set errno on error.
- John Bossom <jebossom@cognos.com>
(_pthread_sem_timedwait): Moved to private.c.
* private.c (_pthread_sem_timedwait): Moved from semaphore.c;
set errno on error.
* errno.c (_errno): New file. New function.
- John Bossom
* pthread.h (pthread_t_): Add per-thread errno element.
tests/ChangeLog
Sun Apr 4 12:04:28 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* tsd1.c (mythread): Change Sleep(0) to sched_yield().
(sched.h): Include.
* condvar3.c (mythread): Remove redundant Sleep().
* runtest.bat: Re-organised to make more informative.
|
|
Fri Mar 19 09:12:59 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* private.c (_pthread_threadStart): status returns PTHREAD_CANCELED.
* pthread.h (PTHREAD_CANCELED): defined.
==> tests/ChangeLog <==
Fri Mar 19 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* *.bat: redirect unwanted output to nul:
* runall.bat: new.
* cancel1.c: new. Not part of suite yet.
|
|
|
|
|