Age | Commit message (Collapse) | Author |
|
* README: Updated.
|
|
* 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.
|
|
* 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>
|
|
* private.c (_pthread_sem_timedwait): Move from semaphore.c.
* semaphore.c : Remove redundant #includes.
(_pthread_sem_timedwait): Move to private.c.
(sem_wait): Add missing abstime arg to pthreadCancelableWait() call.
1999-01-17 Ross Johnson <rpj@ise.canberra.edu.au>
* runtest: New script to build and run a test in the tests directory.
|
|
* pthread.h: Add new 'abstime' arg to pthreadCancelableWait()
prototype.
* condvar.c (cond_timedwait): New generalised function called by
both pthread_cond_wait() and pthread_cond_timedwait(). This is
essentially pthread_cond_wait() renamed and modified to add the
'abstime' arg and call the new _pthread_sem_timedwait() instead of
sem_wait().
(pthread_cond_wait): Now just calls the internal static
function cond_timedwait() with an INFINITE wait.
(pthread_cond_timedwait): Now implemented. Calls the internal
static function cond_timedwait().
* implement.h (_pthread_sem_timedwait): New internal function
prototype.
* misc.c (pthreadCancelableWait): Added new 'abstime' argument
to allow shorter than INFINITE wait.
* semaphore.c (_pthread_sem_timedwait): New function for internal
use. This is essentially sem_wait() modified to add the
'abstime' arg and call the modified (see above)
pthreadCancelableWait().
|
|
* cleanup.c: Correct _cplusplus to __cplusplus wherever used.
* Makefile.in: Add CC=g++ and add -fhandle-exceptions to CFLAGS.
The derived Makefile will compile all units of the package as C++
so that those which include try/catch exception handling should work
properly. The package should compile ok if CC=gcc, however, exception
handling will not be included and thus thread cancellation, for
example, will not work.
* cleanup.c (_pthread_pop_cleanup): Add #warning to compile this
file as C++ if using a cygwin32 environment. Perhaps the whole package
should be compiled using g++ under cygwin.
* private.c (_pthread_threadStart): Change #error directive
into #warning and bracket for __CYGWIN__ and derivative compilers.
|
|
* build.bat: Delete old binaries before compiling/linking.
Tue Jan 12 09:58:38 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* dll.c: The Microsoft compiler pragmas probably are more
appropriately protected by _MSC_VER than by _WIN32.
- Tor Lillqvist <tml@iki.fi>.
* condvar.c (pthread_cond_timedwait): Fix function description
comments.
* pthread.h: Define ETIMEDOUT. This should be returned by
pthread_cond_timedwait which is not implemented yet as of
snapshot-1999-01-04-1305. It was implemented in the older version.
The Microsoft compiler pragmas probably are more appropriately
protected by _MSC_VER than by _WIN32.
- Tor Lillqvist <tml@iki.fi>.
* pthread.def: pthread_mutex_destroy was missing from the def file
- Tor Lillqvist <tml@iki.fi>.
* condvar.c (pthread_cond_broadcast): Ensure we only wait on threads
if there were any waiting on the condition.
I think pthread_cond_broadcast should do the WaitForSingleObject
only if cv->waiters > 0? Otherwise it seems to hang, at least in the
testg thread program from glib.
- Tor Lillqvist <tml@iki.fi>.
* semaphore.c (sem_post): Correct typo in comment.
Mon Jan 11 20:33:19 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* pthread.h: Re-arrange conditional compile of pthread_cleanup-*
macros.
* cleanup.c (_pthread_push_cleanup): Provide conditional
compile of cleanup->prev.
|
|
* condvar.c (pthread_cond_init): Invert logic when testing the
return value from calloc().
|
|
* implement.h: Compile-time switch for CYGWIN derived environments
to use CreateThread instead of _beginthreadex. Ditto for ExitThread.
Patch provided by Anders Norlander <anorland@hem2.passagen.se>.
|
|
now use exception handling to implement thread cancellation. The MSC compiler
appears to know about __try/__except blocks, but gcc (ie. the GNU ANSI C
compiler) doesn't know about the equivalent C++ try/catch blocks. This should
not be a problem since gcc and g++ are nearly always available together. Some
file names may need to change in the CVS repository however.
Tue Jan 5 16:33:04 1999 Ross Johnson <rpj@swan.canberra.edu.au>
* cleanup.c (_pthread_pop_cleanup): Add C++ version of __try/__except
block. Move trailing "}" out of #ifdef _WIN32 block left there by
(my) mistake.
* private.c: Remove #include <errno.h> which is included by pthread.h.
|
|
This will be tagged as snapshot-1999-01-04-1305
|
|
* README: Update info about subscribing to the mailing list.
|
|
Q 1 How do I get pthreads-win32 to link under Cygwin32 or Mingw32?
|
|
* dll.c (PthreadsEntryPoint): Cast return value of GetProcAddress
to resolve compile warning from MSVC.
|
|
* buildlib.bat: Fix args to CL when building the .DLL
* cleanup.c (_pthread_destructor_run_all): Fix TSD key management.
This is a tidy-up before TSD and Thread management is completely
replaced by John Bossom's much more elegant code.
* tsd.c (pthread_key_create): Fix TSD key management.
* global.c (_pthread_key_virgin_next): Initialise.
* build.bat: New DOS script to compile and link a pthreads app
using Microsoft's CL compiler linker.
* buildlib.bat: New DOS script to compile all the object files
and create pthread.lib and pthread.dll using Microsoft's CL
compiler linker.
|
|
* build.bat: New DOS script to compile and link a pthreads app
using Microsoft's CL compiler linker.
* buildlib.bat: New DOS script to compile all the object files
and create pthread.lib and pthread.dll using Microsoft's CL
compiler linker.
|
|
* README: Correct cygwin32 compatibility statement.
|
|
that hadn't been checked in. Those are to finish off the original TSD management
scheme which will now start to be replaced by John Bossom's implementation.
Anders' description of his changes:-
Fixes the problem with
`TryEnterCriticalSection' on w95 systems. Instead
of directly calling `TryEnterCriticalSection' it
tries to get a pointer at DLL startup and only calls
the function if it exists. See ChangeLog for things
changed.
1998-12-05 Anders Norlander <anorland@hem2.passagen.se>
* implement.h (_pthread_try_enter_critical_section): New extern
* dll.c (_pthread_try_enter_critical_section): New pointer to
TryEnterCriticalSection if it exists; otherwise NULL.
* dll.c (PthreadsEntryPoint):
Initialize _pthread_try_enter_critical_section at startup
and release kernel32 handle when DLL is being unloaded.
* mutex.c (pthread_mutex_trylock): Replaced check for NT with
a check if _pthread_try_enter_critical_section is valid
pointer to a function. Call _pthread_try_enter_critical_section
instead of TryEnterCriticalSection to avoid errors on Win95.
Sun Nov 15 21:24:06 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* cleanup.c (_pthread_destructor_run_all): Declare missing void * arg.
Fixup CVS merge conflicts.
Fri Oct 30 15:15:50 1998 Ross Johnson <rpj@swan.canberra.edu.au>
* cleanup.c (_pthread_handler_push): Fixed bug appending new
handler to list reported by Peter Slacik
<Peter.Slacik@leibinger.freinet.de>.
(new_thread): Rename poorly named local variable to
"new_handler".
Sat Oct 24 18:34:59 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* global.c: Add TSD key management array and index declarations.
* implement.h: Ditto for externs.
Fri Oct 23 00:08:09 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* implement.h (_PTHREAD_TSD_KEY_REUSE): Add enum.
* private.c (_pthread_delete_thread): Add call to
_pthread_destructor_run_all() to clean up the threads keys.
* cleanup.c (_pthread_destructor_run_all): Check for no more dirty
keys to run destructors on. Assume that the destructor call always
succeeds and set the key value to NULL.
|
|
* condvar.c (cond_wait): Fix semantic error. Test for equality
instead of making an assignment.
|
|
* cleanup.c (_pthread_handler_push): Fixed bug appending new
handler to list reported by Peter Slacik
<Peter.Slacik@leibinger.freinet.de>.
(new_thread): Rename poorly named local variable to
"new_handler".
|
|
* tsd.c: Add description of pthread_key_delete() from the
standard as a comment.
|
|
* tsd1.c (mythread): Fix some casts and add some diagnostics.
Fix inverted conditional.
|
|
* private.c (_pthread_new_thread): Remove init of destructorstack.
No longer an element of pthread_t.
|
|
* tsd.c (pthread_setspecific): Fix type declaration and cast.
(pthread_getspecific): Ditto.
(pthread_getspecific): Change error return value to NULL if key
is not in use.
Yet again.
|
|
* tsd.c (pthread_setspecific): Fix type declaration and cast.
(pthread_getspecific): Ditto.
|
|
* global.c (_pthread_tsd_key_table): Fix declaration.
* implement.h(_pthread_TSD_keys_TlsIndex): Add missing extern.
(_pthread_tsd_mutex): Ditto.
* create.c (_pthread_start_call): Fix "keys" array declaration.
Add comment.
* tsd.c (pthread_setspecific): Fix type declaration and cast.
(pthread_getspecific): Ditto.
* cleanup.c (_pthread_destructor_run_all): Declare missing loop
counter.
|
|
* private.c (_pthread_new_thread): Increment _pthread_threads_count.
(_pthread_delete_thread): Decrement _pthread_threads_count.
Remove some comments.
* exit.c (_pthread_exit): : Fix two pthread_mutex_lock() calls that
should have been pthread_mutex_unlock() calls.
(_pthread_vacuum): Remove call to _pthread_destructor_pop_all().
* create.c (pthread_create): Fix two pthread_mutex_lock() calls that
should have been pthread_mutex_unlock() calls.
* global.c (_pthread_tsd_mutex): Add mutex for TSD operations.
* tsd.c (pthread_key_create): Add critical section.
(pthread_setspecific): Ditto.
(pthread_getspecific): Ditto.
(pthread_key_delete): Ditto.
* sync.c (pthread_join): Fix two pthread_mutex_lock() calls that
should have been pthread_mutex_unlock() calls.
|
|
* implement.h (_pthread_tsd_key_table): New.
* create.c (_pthread_start_call): Initialise per-thread TSD keys
to NULL.
* misc.c (pthread_once): Correct typo in comment.
* implement.h (_pthread_destructor_push): Remove.
(_pthread_destructor_pop): Remove.
(_pthread_destructor_run_all): Rename from _pthread_destructor_pop_all.
(_PTHREAD_TSD_KEY_DELETED): Add enum.
(_PTHREAD_TSD_KEY_INUSE): Add enum.
* cleanup.c (_pthread_destructor_push): Remove.
(_pthread_destructor_pop): Remove.
(_pthread_destructor_run_all): Totally revamped TSD.
* dll.c (_pthread_TSD_keys_TlsIndex): Initialise.
* tsd.c (pthread_setspecific): Totally revamped TSD.
(pthread_getspecific): Ditto.
(pthread_create): Ditto.
(pthread_delete): Ditto.
Sun Oct 11 22:44:55 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* global.c (_pthread_tsd_key_table): Add new global.
* implement.h (_pthread_tsd_key_t and struct _pthread_tsd_key):
Add.
(struct _pthread): Remove destructorstack.
* cleanup.c (_pthread_destructor_run_all): Rename from
_pthread_destructor_pop_all. The key destructor stack was made
global rather than per-thread. No longer removes destructor nodes
from the stack. Comments updated.
|
|
* tsd1.c: New. Test TSD using 1 key and 2 threads.
|
|
|
|
* condvar.c (cond_wait): Use POSIX, not Win32 mutex calls.
(pthread_cond_broadcast): Likewise.
(pthread_cond_signal): Likewise.
|
|
|
|
* pthread.def: Update. Some functions aren't available yet, others
are macros in <pthread.h>.
* tests/join.c: Remove; useless.
|
|
* pthread.def: New file for building the DLL.
|
|
* tests/self.c: Remove; rename to self1.c.
* tests/self1.c: This is the old self.c.
* tests/self2.c: New file. Test pthread_self() with a single
thread. Passes.
* tests/self3.c: New file. Test pthread_self() with a couple of
threads to ensure their thread IDs differ. Passes.
|
|
* misc.c (pthread_once): Use the POSIX mutex primitives, not Win32.
Remove irrelevant FIXME comment.
* pthread.h (PTHREAD_ONCE_INIT): Define.
* tests/once1.c: New file; test for pthread_once(). Passes.
|
|
* misc.c (pthread_equal): Correct inverted logic bug.
* tests/create1.c: New file; test pthread_create(). Passes.
* tests/equal.c: Poor test; remove.
* tests/equal1.c New file; test pthread_equal(). Passes.
|
|
|
|
* global.c (PTHREAD_MUTEX_INITIALIZER): Move to pthread.h.
* pthread.h (PTHREAD_MUTEX_INITIALIZER): Define.
(pthread_mutex_t): Reimplement as a struct containing a valid
flag. If the flag is ever down upon entry to a mutex operation,
we call pthread_mutex_create() to initialise the object. This
fixes the problem of how to handle statically initialised objects
that can't call InitializeCriticalSection() due to their context.
* mutex.c (pthread_mutex_init): Set valid flag.
(pthread_mutex_destroy): Clear valid flag.
(pthread_mutex_lock): Check and handle the valid flag.
(pthread_mutex_unlock): Likewise.
(pthread_mutex_trylock): Likewise.
* tests/mutex3.c: New file; test for the static initialisation
macro. Passes.
|
|
* tests/mutex2.c: Test pthread_mutex_trylock(). Passes.
* tests/mutex1.c (main): Eliminate warning.
|
|
* tests/mutex1.c: New basic test for mutex functions (it passes).
|
|
* configure.in: Test for __stdcall, not _stdcall. Typo.
* configure: Regenerate.
|
|
* attr.c (pthread_attr_setstackaddr): Remove FIXME comment. Win32
does know about ENOSYS after all.
(pthread_attr_setstackaddr): Likewise.
|
|
* create.c (_pthread_start_call): Add STDCALL prefix.
|
|
|
|
|
|
* config.h.in: Regenerate.
|
|
* configure.in: Test for the `_stdcall' keyword. Define `STDCALL'
to `_stdcall' if we have it, null otherwise.
* configure: Regenerate.
* acconfig.h (STDCALL): New define.
|
|
* mutex.c (pthread_mutex_init): Correct function signature.
|
|
* attr.c (pthread_attr_init): Only zero out the `sigmask' member
if we have the sigset_t type.
* pthread.h (pthread_sigmask): Only provide if we have the
sigset_t type.
|