Age | Commit message (Collapse) | Author |
|
* 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].
|
|
2000-12-29 Ross Johnson <rpj@special.ise.canberra.edu.au>
* Makefile: Back-out "for" loops which don't work.
* GNUmakefile: Remove the fake.a target; add the "realclean"
target; don't remove built libs under the "clean" target.
* config.h: Add a guard against multiple inclusion.
* semaphore.h: Add some defines from config.h to make
semaphore.h independent of config.h when building apps.
* pthread.h (_errno): Back-out previous fix until we know how to
fix it properly.
* implement.h (lockCount): Add missing element to pthread_mutex_t_.
* sync.c (pthread_join): Spelling fix in comment.
* private.c (ptw32_threadStart): Reset original termination
function (C++).
(ptw32_threadStart): Cleanup detached threads early in case
the library is statically linked.
(ptw32_callUserDestroyRoutines): Remove [SEH] __try block from
destructor call so that unhandled exceptions will be passed through
to the system; call terminate() from [C++] try block for the same
reason.
* tsd.c (pthread_getspecific): Add comment.
* mutex.c (pthread_mutex_init): Initialise new elements in
pthread_mutex_t.
(pthread_mutex_unlock): Invert "pthread_equal()" test.
2000-12-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
* semaphore.c (mode_t): Use ifndef HAVE_MODE_T to include definition.
* config.h.in (HAVE_MODE_T): Added.
(_UWIN): Start adding defines for the UWIN package.
./tests/ChangeLog:
2000-12-29 Ross Johnson <rpj@special.ise.canberra.edu.au>
* GNUmakefile: Add mutex4 test; ensure libpthreadw32.a is
removed for "clean" target.
* Makefile: Add mutex4 test.
* exception3.c: Remove SEH code; automatically pass the test
under SEH (which is an N/A environment).
* mutex4.c: New test.
* eyal1.c (do_work_unit): Add a dummy "if" to force the
optimiser to retain code; reduce thread work loads.
* condvar8.c (main): Add an additional "assert" for debugging;
increase pthread_cond_signal timeout.
|
|
2000-12-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
* private.c (ptw32_threadStart): Unhandled exceptions are
now passed through to the system to deal with. This is consistent
with normal Windows behaviour. C++ applications may use
set_terminate() to override the default behaviour which is
to call ptw32_terminate(). Ptw32_terminate() cleans up some
POSIX thread stuff before calling the system default function
which calls abort(). The users termination function should conform
to standard C++ semantics which is to not return. It should
exit the thread (call pthread_exit()) or exit the application.
* private.c (ptw32_terminate): Added as the default set_terminate()
function. It calls the system default function after cleaning up
some POSIX thread stuff.
* implement.h (ptw32_try_enter_critical_section): Move
declaration.
* global.c (ptw32_try_enter_critical_section): Moved
from dll.c.
* dll.c: Move process and thread attach/detach code into
functions in nonportable.c.
* nonportable.c (pthread_win32_process_attach_np): Process
attach code from dll.c is now available to static linked
applications.
* nonportable.c (pthread_win32_process_detach_np): Likewise.
* nonportable.c (pthread_win32_thread_attach_np): Likewise.
* nonportable.c (pthread_win32_thread_detach_np): Likewise.
* pthread.h: Add new non-portable prototypes for static
linked applications.
* GNUmakefile (OPT): Increase optimisation flag and remove
debug info flag.
* pthread.def: Add new non-portable exports for static
linked applications.
2000-12-11 Ross Johnson <rpj@special.ise.canberra.edu.au>
* FAQ: Update Answer 6 re getting a fully working
Mingw32 built library.
2000-09-09 Ross Johnson <rpj@special.ise.canberra.edu.au>
* pthread.h (ctime_r): Fix arg.
./tests/ChangeLog:
2000-12-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
* eyal1.c: Increase thread work loads.
* exception2.c: New test.
* exception3.c: New test.
* Makefile: Add new tests exception2.c and exception3.c.
* GNUmakefile: Likewise.
2000-12-11 Ross Johnson <rpj@special.ise.canberra.edu.au>
* cleanup3.c: Remove unused variable.
* cleanup2.c: Likewise.
* exception1.c: Throw an exception rather than use
a deliberate zero divide so that catch(...) will
handle it under Mingw32. Mingw32 now builds the
library correctly to pass all tests - see Thomas
Pfaff's detailed instructions re needed changes
to Mingw32 in the Pthreads-Win32 FAQ.
|
|
* 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.
|
|
* 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.
|
|
* pthread.h: Remove #warning - VC++ doesn't accept it.
2000-08-05 Ross Johnson <rpj@special.ise.canberra.edu.au>
* pthread.h (PtW32CatchAll): Add macro. When compiling
applications using VC++ with C++ EH rather than SEH
'PtW32CatchAll' must be used in place of any 'catch( ... )'
if the application wants pthread cancelation or
pthread_exit() to work.
2000-08-03 Ross Johnson <rpj@special.ise.canberra.edu.au>
* pthread.h: Add a base class Pthread_exception for
library internal exceptions and change the "catch"
re-define macro to use it.
2000-08-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
* GNUmakefile (CFLAGS): Add -mthreads.
Add new targets to generate cpp and asm output.
* sync.c (pthread_join): Remove dead code.
tests:
2000-08-06 Ross Johnson <rpj@special.ise.canberra.edu.au>
* ccl.bat: Add /nologo to remove extraneous output.
* exception1.c (exceptionedThread): Init 'dummy';
put expression into if condition to prevent optimising away;
remove unused variable.
* cancel4.c (mythread): Cast return value to avoid warnings.
* cancel2.c (mythread): Missing #endif.
* condvar9.c (mythread): Cast return value to avoid warnings.
* condvar8.c (mythread): Cast return value to avoid warnings.
* condvar7.c (mythread): Cast return value to avoid warnings.
* cleanup3.c (mythread): Cast return value to avoid warnings.
* cleanup2.c (mythread): Cast return value to avoid warnings.
* cleanup1.c (mythread): Cast return value to avoid warnings.
* condvar5.c (mythread): Cast return value to avoid warnings.
* condvar3.c (mythread): Cast return value to avoid warnings.
* condvar6.c (mythread): Cast return value to avoid warnings.
* condvar4.c (mythread): Cast return value to avoid warnings.
2000-08-05 Ross Johnson <rpj@special.ise.canberra.edu.au>
* cancel2.c: Use PtW32CatchAll macro if defined.
* exception1.c: Use PtW32CatchAll macro if defined.
2000-08-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
* tsd1.c: Fix typecasts of &result [g++ is now very fussy].
* test.h (assert): Return 0's explicitly to allay
g++ errors.
* join2.c: Add explicit typecasts.
* join1.c: Add explicit typecasts.
* join0.c: Add explicit typecasts.
* eyal1.c: Add explicit typecasts.
* count1.c (main): Add type cast to remove g++ parse warning
[gcc-2.95.2 seems to have tightened up on this].
* Makefile (GLANG): Use c++ explicitly.
Remove MSVC sections (was commented out).
Add target to generate cpp output.
|
|
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>
|
|
* pthread.h (pthread_mutex_t): revert to (pthread_mutex_t *);
define a value to serve as PTHREAD_MUTEX_INITIALIZER.
(pthread_mutex_t_): remove staticinit and valid elements.
(pthread_cond_t): revert to (pthread_cond_t_ *);
define a value to serve as PTHREAD_COND_INITIALIZER.
(pthread_cond_t_): remove staticinit and valid elements.
* mutex.c (pthread_mutex_t args): adjust indirection of references.
(all functions): check for PTHREAD_MUTEX_INITIALIZER value;
check for NULL (invalid).
* condvar.c (pthread_cond_t args): adjust indirection of references.
(all functions): check for PTHREAD_COND_INITIALIZER value;
check for NULL (invalid).
Wed Mar 10 17:18:12 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* misc.c (CancelableWait): Undo changes from Mar 8 and 7.
tests/ChangeLog
Fri Mar 12 08:34:15 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* eyal1.c (main): Fix trylock loop; was not waiting for thread to lock
the "started" mutex.
|
|
* Makefile: Some refinement.
* *.c: More exhaustive checking through assertions; clean up;
add some more tests.
|
|
* pthread.h (pthread_mutexattr_t): Changed to a pointer.
* mutex.c (pthread_mutex_init): Conditionally create Win32 mutex
- from John Bossom's implementation.
(pthread_mutex_destroy): Conditionally close Win32 mutex
- from John Bossom's implementation.
(pthread_mutexattr_init): Replaced by John Bossom's version.
(pthread_mutexattr_destroy): Ditto.
(pthread_mutexattr_getpshared): New function from John Bossom's
implementation.
(pthread_mutexattr_setpshared): New function from John Bossom's
implementation.
Tue Jan 19 18:27:42 1999 Ross Johnson <rpj@swan.canberra.edu.au>
* pthread.h (pthreadCancelableTimedWait): New prototype.
(pthreadCancelableWait): Remove second argument.
* misc.c (CancelableWait): New static function is
pthreadCancelableWait() renamed.
(pthreadCancelableWait): Now just calls CancelableWait() with
INFINITE timeout.
(pthreadCancelableTimedWait): Just calls CancelableWait()
with passed in timeout.
* private.c (_pthread_sem_timedwait): 'abstime' arg really is
absolute time. Calculate relative time to wait from current
time before passing timeout to new routine
pthreadCancelableTimedWait().
- Scott Lightner <scott@curriculum.com>
Tue Jan 19 10:27:39 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* pthread.h (pthread_mutexattr_setforcecs_np): New prototype.
* mutex.c (pthread_mutexattr_init): Init 'pshared' and 'forcecs'
attributes to 0.
(pthread_mutexattr_setforcecs_np): New function (not portable).
* pthread.h (pthread_mutex_t):
Add 'mutex' element. Set to NULL in PTHREAD_MUTEX_INITIALIZER.
The pthread_mutex_*() routines will try to optimise performance
by choosing either mutexes or critical sections as the basis
for pthread mutexes for each indevidual mutex.
(pthread_mutexattr_t_): Add 'forcecs' element.
Some applications may choose to force use of critical sections
if they know that:-
the mutex is PROCESS_PRIVATE and,
either the OS supports TryEnterCriticalSection() or
pthread_mutex_trylock() will never be called on the mutex.
This attribute will be setable via a non-portable routine.
Note: We don't yet support PROCESS_SHARED mutexes, so the
implementation as it stands will default to Win32 mutexes only if
the OS doesn't support TryEnterCriticalSection. On Win9x, and early
versions of NT 'forcecs' will need to be set in order to get
critical section based mutexes.
Sun Jan 17 12:01:26 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* pthread.h (PTHREAD_MUTEX_INITIALIZER): Init new 'staticinit'
value to '1' and existing 'valid' value to '1'.
* global.c (_pthread_mutex_test_init_lock): Add.
* implement.h (_pthread_mutex_test_init_lock.): Add extern.
* private.c (_pthread_processInitialize): Init critical section for
global lock used by _mutex_check_need_init().
(_pthread_processTerminate): Ditto (:s/Init/Destroy/).
* dll.c (dllMain): Move call to FreeLibrary() so that it is only
called once when the process detaches.
* mutex.c (_mutex_check_need_init): New static function to test
and init PTHREAD_MUTEX_INITIALIZER mutexes. Provides serialised
access to the internal state of the uninitialised static mutex.
Called from pthread_mutex_trylock() and pthread_mutex_lock() which
do a quick unguarded test to check if _mutex_check_need_init()
needs to be called. This is safe as the test is conservative
and is repeated inside the guarded section of
_mutex_check_need_init(). Thus in all calls except the first
calls to lock static mutexes, the additional overhead to lock any
mutex is a single memory fetch and test for zero.
* pthread.h (pthread_mutex_t_): Add 'staticinit' member. Mutexes
initialised by PTHREAD_MUTEX_INITIALIZER aren't really initialised
until the first attempt to lock it. Using the 'valid'
flag (which flags the mutex as destroyed or not) to record this
information would be messy. It is possible for a statically
initialised mutex such as this to be destroyed before ever being
used.
* mutex.c (pthread_mutex_trylock): Call _mutex_check_need_init()
to test/init PTHREAD_MUTEX_INITIALIZER mutexes.
(pthread_mutex_lock): Ditto.
(pthread_mutex_unlock): Add check to ensure we don't try to unlock
an unitialised static mutex.
(pthread_mutex_destroy): Add check to ensure we don't try to delete
a critical section that we never created. Allows us to destroy
a static mutex that has never been locked (and hence initialised).
(pthread_mutex_init): Set 'staticinit' flag to 0 for the new mutex.
|
|
* eyal1.c: New file; contributed by Eyal Lebedinsky
<eyal@eyal.emu.id.au>.
|