Age | Commit message (Collapse) | Author |
|
* semaphore.c: Comment format changes.
Wed Feb 3 13:04:44 1999 Ross Johnson <rpj@swan.canberra.edu.au>
* cleanup.c: Rename _pthread_*_cleanup() to pthread_*_cleanup().
* pthread.def: Ditto.
* pthread.h: Ditto.
* pthread.def (pthread_cleanup_push): Remove from export list;
the function is defined as a macro under all compilers.
(pthread_cleanup_pop): Ditto.
* pthread.h: Remove #if defined().
|
|
Tue Feb 2 18:07:43 1999 Ross Johnson <rpj@swan.canberra.edu.au>
* implement.h: Add #include <pthread.h>.
Change sem_t to _pthread_sem_t.
Various patches by Kevin Ruland <Kevin.Ruland@anheuser-busch.com>
* signal.c (pthread_sigmask): Add and modify casts.
Reverse LHS/RHS bitwise assignments.
* pthread.h: Remove #include <semaphore.h>.
(_PTHREAD_ATTR_VALID): Add cast.
(struct pthread_t_): Add sigmask element.
* dll.c: Add "extern C" for DLLMain.
(DllMain): Add cast.
* create.c (pthread_create): Set sigmask in thread.
* condvar.c: Remove #include. Change sem_* to _pthread_sem_*.
* attr.c: Changed #include.
* Makefile.in: Additional targets and changes to build the library
as a DLL.
Fri Jan 29 11:56:28 1999 Ross Johnson <rpj@swan.canberra.edu.au>
* Makefile.in (OBJS): Add semaphore.o to list.
* semaphore.c (_pthread_sem_timedwait): Move from private.c.
Rename sem_* to _pthread_sem_*.
* pthread.h (pthread_cond_t): Change type of sem_t.
_POSIX_SEMAPHORES no longer defined.
* semaphore.h: Contents moved to implement.h.
Removed from source tree.
* implement.h: Add semaphore function prototypes and ename all
functions to prepend '_pthread_'. They are
now private to the pthreads-win32 implementation.
* private.c: Change #warning.
Move _pthread_sem_timedwait() to semaphore.c.
* cleanup.c: Change #warning.
* misc.c: Remove #include <errno.h>
* pthread.def: Cleanup CVS merge conflicts.
* global.c: Ditto.
* ChangeLog: Ditto.
* cleanup.c: Ditto.
|
|
Sun Jan 24 01:34:52 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* semaphore.c (sem_wait): Remove second arg to
pthreadCancelableWait() call.
Fri Jan 22 14:31:59 1999 Ross Johnson <rpj@swan.canberra.edu.au>
* Makefile.in (CFLAGS): Remove -fhandle-exceptions. Not needed
with egcs. Add -g for debugging.
* create.c (pthread_create): Replace __stdcall with PT_STDCALL
macro. This is a hack and must be fixed.
* misc.c (CancelableWait): Remove redundant statement.
* mutex.c (pthread_mutexattr_init): Cast calloc return value.
* misc.c (CancelableWait): Add cast.
(pthread_self): Add cast.
* exit.c (pthread_exit): Add cast.
* condvar.c (pthread_condattr_init): Cast calloc return value.
* cleanup.c: Reorganise conditional compilation.
* attr.c (pthread_attr_init): Remove unused 'result'.
Cast malloc return value.
* private.c (_pthread_callUserDestroyRoutines): Redo conditional
compilation.
* misc.c (CancelableWait): C++ version uses 'throw'.
* cancel.c (pthread_testcancel): Ditto.
* implement.h (class pthread_exception): Define for C++.
* pthread.h: Fix C, C++, and Win32 SEH condition compilation
mayhem around pthread_cleanup_* defines. C++ version now uses John
Bossom's cleanup handlers.
(pthread_attr_t): Make 'valid' unsigned.
Define '_timeb' as 'timeb' for Ming32.
Define PT_STDCALL as nothing for Mingw32. May be temporary.
* cancel.c (pthread_testcancel): Cast return value.
|
|
* pthread.h (PTHREAD_MUTEX_AUTO_CS_NP): New.
(PTHREAD_MUTEX_FORCE_CS_NP): New.
|
|
* 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>
|
|
* 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().
|
|
* 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.
|
|
This will be tagged as snapshot-1999-01-04-1305
|
|
* 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.
|
|
* 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.
|
|
* 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.
|
|
|
|
* 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.
|
|
* pthread.h: No need to include <unistd.h>. It doesn't even exist
on Win32! Again, an artifact of cross-compilation.
|
|
* process.h: Remove. This was a stand-in before we started doing
native compilation under Win32.
* pthread.h (pthread_mutex_init): Make `attr' argument const.
|
|
* Makefile (LIB): Define.
(clean): Define target.
(all): Build a library not just the object files.
* pthread.h: Provide a definition for struct timespec if we don't
already have one.
* windows.c (TlsGetValue): Bug fix.
|
|
* implement.h(_pthread_virgins): Add extern.
(_pthread_virgin_next): Ditto.
(_pthread_reuse): Ditto.
(_pthread_reuse_top): Ditto.
(_pthread_win32handle_map): Ditto.
(_pthread_threads_mutex_table): Ditto.
* global.c (_pthread_virgins): Changed from array to pointer.
Storage allocation for the array moved into dll.c.
(_pthread_reuse): Ditto.
(_pthread_win32handle_map): Ditto.
(_pthread_threads_mutex_table): Ditto.
* dll.c (PthreadsEntryPoint): Set up thread admin storage when
DLL is loaded.
* fork.c (pthread_atfork): Fix function pointer arg to all
_pthread_handler_push() calls. Change "arg" arg to NULL in child push.
* exit.c: Add windows.h and process.h includes.
(_pthread_exit): Add local detachstate declaration.
(_pthread_exit): Fix incorrect name for pthread_attr_getdetachstate().
* pthread.h (_POSIX_THREAD_ATTR_STACKSIZE): Move from global.c
(_POSIX_THREAD_ATTR_STACKADDR): Ditto.
* create.c (pthread_create): Fix #if should be #ifdef.
(_pthread_start_call): Remove usused variables.
* process.h: Create.
* windows.h: Move _beginthreadex and _endthreadex into
process.h
Mon Aug 3 21:19:57 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* condvar.c (pthread_cond_init): Add NULL attr to
pthread_mutex_init() call - default attributes will be used.
(cond_wait): Fix typo.
(cond_wait): Fix typo - cv was ev.
(pthread_cond_broadcast): Fix two identical typos.
* cleanup.c (_pthread_destructor_pop_all): Remove _ prefix from
PTHREAD_DESTRUCTOR_ITERATIONS.
* pthread.h: Move _POSIX_* values into posix.h
* pthread.h: Fix typo in pthread_mutex_init() prototype.
* attr.c (pthread_attr_init): Fix error in priority member init.
* windows.h (THREAD_PRIORITY_NORMAL): Add.
* pthread.h (sched_param): Add missing ';' to struct definition.
* attr.c (pthread_attr_init): Remove obsolete pthread_attr_t
member initialisation - cancelstate, canceltype, cancel_pending.
(is_attr): Make arg "attr" a const.
* implement.h (_PTHREAD_HANDLER_POP_LIFO): Remove definition.
(_PTHREAD_HANDLER_POP_FIFO): Ditto.
(_PTHREAD_VALID): Add missing newline escape (\).
(_pthread_handler_node): Make element "next" a pointer.
|
|
* config.h: Create. This is a temporary stand-in for autoconf yet
to be done.
(HAVE_SIGNAL_H): Add.
* pthread.h: Minor rearrangement for temporary config.h.
|
|
* Makefile (SRCS): Create. Preliminary.
* windows.h: Create. Contains Win32 definitions for compile
testing. This is just a standin for the real one.
* pthread.h (SIG_UNBLOCK): Fix typo. Was SIG_BLOCK.
(windows.h): Add include. Required for CRITICAL_SECTION.
(pthread_cond_t): Move enum declaration outside of struct
definition.
(unistd.h): Add include - may be temporary.
* condvar.c (windows.h): Add include.
|
|
* create.c (pthread_create): Start of rewrite. Not completed yet.
* private.c (_pthread_new_thread_entry): Start of rewrite. Not
complete.
* implement.h (_pthread_threads_thread): Rename, remove thread
member, add win32handle and ptstatus members.
(_pthread_t): Add.
* pthread.h: pthread_t is no longer mapped directly to a Win32
HANDLE type. This is so we can let the Win32 thread terminate and
reuse the HANDLE while pthreads holds it's own thread ID until
the last waiting join exits.
|
|
* mutex.c (pthread_mutexattr_setpshared): Not supported; remove.
(pthread_mutexattr_getpshared): Likewise.
* pthread.h (pthread_mutexattr_setpshared): Remove prototype.
(pthread_mutexattr_getpshared): Likewise.
|
|
* pthread.h: Converting PTHREAD_* defines to alias the (const int)
values in global.c.
* global.c: Started converting PTHREAD_* defines to (const int) as
a part of making the eventual pthreads DLL binary compatible
through version changes.
|
|
* private.c (_pthread_delete_thread_entry): Mutex locks removed.
Mutexes must be applied at the caller level.
(_pthread_new_thread_entry): Ditto.
(_pthread_new_thread_entry): Init cancelstate, canceltype, and
cancel_pending to default values.
(_pthread_new_thread_entry): Rename "this" to "new".
(_pthread_find_thread_entry): Rename "this" to "entry".
(_pthread_delete_thread_entry): Rename "thread_entry" to "entry".
* create.c (_pthread_start_call): Mutexes changed to
_pthread_count_mutex. All access to the threads table entries is
under the one mutex. Otherwise chaos reigns.
Sat Jul 25 23:16:51 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* implement.h (_pthread_threads_thread): Move cancelstate and
canceltype members out of pthread_attr_t into here.
|
|
* create.c (_pthread_start_call): Set thread priority. Ensure our
thread entry is removed from the thread table but only if
pthread_detach() was called and there are no waiting joins.
(pthread_create): Set detach flag in thread entry if the
thread is created PTHREAD_CREATE_DETACHED.
* pthread.h (pthread_attr_t): Rename member "detachedstate".
* attr.c (pthread_attr_init): Rename attr members.
* exit.c (pthread_exit): Fix indirection mistake.
* implement.h (_PTHREAD_THREADS_TABLE_INDEX): Add.
* exit.c (_pthread_vacuum): Fix incorrect args to
_pthread_handler_pop_all() calls.
Make thread entry removal conditional.
* sync.c (pthread_join): Add multiple join and async detach handling.
* implement.h (_PTHREAD_THREADS_TABLE_INDEX): Add.
* global.c (_pthread_threads_mutex_table): Add.
* implement.h (_pthread_once_flag): Remove.
(_pthread_once_lock): Ditto.
(_pthread_threads_mutex_table): Add.
* global.c (_pthread_once_flag): Remove.
(_pthread_once_lock): Ditto.
* sync.c (pthread_join): Fix tests involving new return value
from _pthread_find_thread_entry().
(pthread_detach): Ditto.
* private.c (_pthread_find_thread_entry): Failure return code
changed from -1 to NULL.
|
|
* pthread.h: (pthread_cancel): Add function prototype.
(pthread_testcancel): Ditto.
|
|
* pthread.h (pthread_condattr_t): Rename dummy structure member.
(pthread_mutexattr_t): Likewise.
|
|
* cancel.c (pthread_cancel): Implement.
(pthread_testcancel): Implement.
* exit.c (pthread_exit): Add comment explaining the longjmp().
* implement.h (_pthread_threads_thread_t): New member cancelthread.
(_PTHREAD_YES): Define.
(_PTHREAD_NO): Define.
(RND_SIZEOF): Remove.
* create.c (pthread_create): Rename cancelability to cancelstate.
* pthread.h (pthread_attr_t): Rename cancelability to cancelstate.
(PTHREAD_CANCELED): Define.
|
|
|
|
* pthread.h (SIG_BLOCK): Define if not already defined.
(SIG_UNBLOCK): Likewise.
(SIG_SETMASK): Likewise.
(pthread_attr_t): Add signal mask member.
(pthread_sigmask): Add function prototype.
* signal.c (pthread_sigmask): Implement.
* create.c: #include <string.h> to get a prototype for memcpy().
(pthread_create): New threads inherit their creator's signal
mask. Copy the signal mask to the new thread structure.
|
|
* fork.c (pthread_atfork): Add all the necessary push calls.
Local implementation semantics:
If we get an ENOMEM at any time then ALL handlers
(including those from previous pthread_atfork() calls) will be
popped off each of the three atfork stacks before we return.
(fork): Add all the necessary pop calls. Add the thread cancellation
and join calls to the child fork.
Add #includes.
* implement.h: (_pthread_handler_push): Fix return type and stack arg
type in prototype.
(_pthread_handler_pop): Fix stack arg type in prototype.
(_pthread_handler_pop_all): Fix stack arg type in prototype.
* cleanup.c (_pthread_handler_push): Change return type to int and
return ENOMEM if malloc() fails.
|
|
* attr.c (pthread_attr_destroy): Fix merge conflicts.
(pthread_attr_getdetachstate): Fix merge conflicts.
(pthread_attr_setdetachstate): Fix merge conflicts.
* pthread.h: Fix merge conflicts.
* sync.c (pthread_join): Fix merge conflicts.
|
|
* pthread.h (PTHREAD_CREATE_JOINABLE): Define.
(PTHREAD_CREATE_DETACHED): Likewise.
(pthread_attr_t): Add new structure member `detached'.
(pthread_attr_getdetachstate): Add function prototype.
(pthread_attr_setdetachstate): Likewise.
|
|
* pthread.h (sched_param): Define this type.
(pthread_attr_getschedparam): Add function prototype.
(pthread_attr_setschedparam): Likewise.
(pthread_setcancelstate): Likewise.
(pthread_setcanceltype): Likewise.
(sched_get_priority_min): Likewise.
(sched_get_priority_max): Likewise.
(pthread_mutexattr_setprotocol): Remove; not supported.
(pthread_mutexattr_getprotocol): Likewise.
(pthread_mutexattr_setprioceiling): Likewise.
(pthread_mutexattr_getprioceiling): Likewise.
(pthread_attr_t): Add canceltype member. Update comments.
(SCHED_OTHER): Define this scheduling policy constant.
(SCHED_FIFO): Likewise.
(SCHED_RR): Likewise.
(SCHED_MIN): Define the lowest possible value for this constant.
(SCHED_MAX): Likewise, the maximum possible value.
(PTHREAD_CANCEL_ASYNCHRONOUS): Redefine.
(PTHREAD_CANCEL_DEFERRED): Likewise.
|
|
pthread.h.
* pthread.h: Move implementation hidden definitions into
implement.h.
* implement.h: Move implementation hidden definitions from
pthread.h. Add constants to index into the different handler stacks.
* cleanup.c (_pthread_handler_push): Simplify args. Restructure.
(_pthread_handler_pop): Simplify args. Restructure.
(_pthread_handler_pop_all): Simplify args. Restructure.
|
|
* attr.c, implement.h, pthread.h, ChangeLog: Resolve CVS merge
conflicts.
* private.c (_pthread_find_thread_entry): Changes to return type
to support leaner _pthread_threads_table[] which now only stores
_pthread_thread_thread_t *.
(_pthread_new_thread_entry): Internal changes.
(_pthread_delete_thread_entry): Internal changes to avoid contention.
Calling routines changed accordingly.
* pthread.h: Modified cleanup macros to use new generic push and pop.
Added destructor and atfork stacks to _pthread_threads_thread_t.
* cleanup.c (_pthread_handler_push, _pthread_handler_pop,
_pthread_handler_pop_all): Renamed cleanup push and pop routines
and made generic to handle destructors and atfork handlers as
well.
* create.c (_pthread_start_call): New function is a wrapper for
all new threads. It allows us to do some cleanup when the thread
returns, ie. that is otherwise only done if the thread is cancelled.
* exit.c (_pthread_vacuum): New function contains code from
pthread_exit() that we need in the new _pthread_start_call()
as well.
* implement.h: Various additions and minor changes.
* pthread.h: Various additions and minor changes.
Change cleanup handler macros to use generic handler push and pop
functions.
* attr.c: Minor mods to all functions.
(is_attr): Implemented missing function.
* create.c (pthread_create): More clean up.
* private.c (_pthread_find_thread_entry): Implement.
(_pthread_delete_thread_entry): Implement.
(_pthread_new_thread_entry): Implement.
These functions manipulate the implementations internal thread
table and are part of general code cleanup and modularisation.
They replace _pthread_getthreadindex() which was removed.
* exit.c (pthread_exit): Changed to use the new code above.
* pthread.h: Add cancelability constants. Update comments.
|
|
* attr.c (pthread_setstacksize): Update test of attr argument.
(pthread_getstacksize): Likewise.
(pthread_setstackaddr): Likewise.
(pthread_getstackaddr): Likewise.
(pthread_attr_init): No need to allocate any storage.
(pthread_attr_destroy): No need to free any storage.
* mutex.c (is_attr): Not likely to be needed; remove.
(remove_attr): Likewise.
(insert_attr): Likewise.
* pthread.h (pthread_attr_t): Moved here from implement.h.
* implement.h (_pthread_mutexattr_t): Moved to a public definition
in pthread.h. There was little gain in hiding these details.
(_pthread_condattr_t): Likewise.
|
|
* pthread.h (pthread_atfork): Add function prototype.
* fork.c (pthread_atfork): Preliminary implementation.
(_pthread_fork): Likewise.
|
|
* cleanup.c (_pthread_cleanup_push): Implement.
(_pthread_cleanup_pop): Implement.
(_pthread_do_cancellation): Implement.
These are private to the implementation. The real cleanup functions
are macros. See below.
* pthread.h (pthread_cleanup_push): Implement as a macro.
(pthread_cleanup_pop): Implement as a macro.
Because these are macros which start and end a block, the POSIX scoping
requirement is observed. See the comment in the file.
* exit.c (pthread_exit): Refine the code.
* create.c (pthread_create): Code cleanup.
* implement.h (RND_SIZEOF): Add RND_SIZEOF(T) to round sizeof(T)
up to multiple of DWORD.
Add function prototypes.
* private.c (_pthread_getthreadindex): "*thread" should have been
"thread". Detect empty slot fail condition.
|
|
* pthread.h (_pthread_once_flag): Remove.
(_pthread_once_lock): Remove.
(pthread_once): Add function prototype.
(pthread_once_t): Define this type.
|
|
* pthread.h (_pthread_once_flag): Add new variable.
(_pthread_once_lock): Add new mutex lock to ensure integrity of
access to _pthread_once_flag.
|
|
* private.c (_pthread_getthreadindex): Implement.
* pthread.h: Add application static data dependent on
_PTHREADS_BUILD_DLL define. This is needed to avoid allocating
non-sharable static data within the pthread DLL.
* implement.h: Add _pthread_cleanup_stack_t, _pthread_cleanup_node_t
and _PTHREAD_HASH_INDEX.
* exit.c (pthread_exit): Begin work on cleanup and de-allocate
thread-private storage.
* create.c (pthread_create): Add thread to thread table.
Keep a thread-private copy of the attributes with default values
filled in when necessary. Same for the cleanup stack. Make
pthread_create C run-time library friendly by using _beginthreadex()
instead of CreateThread(). Fix error returns.
Sun Jul 19 16:26:23 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* implement.h: Rename pthreads_thread_count to _pthread_threads_count.
Create _pthread_threads_thread_t struct to keep thread specific data.
* create.c: Rename pthreads_thread_count to _pthread_threads_count.
(pthread_create): Handle errors from CreateThread().
|
|
* pthread.h (pthread_key_t): Define this type.
(pthread_key_create): Add function prototype.
(pthread_setspecific): Likewise.
(pthread_getspecific): Likwise.
(pthread_key_delete): Likewise.
|
|
* pthread.h (pthread_cond_t): Fix for u_int. Do not assume that
the mutex contained withing the pthread_cond_t structure will be a
critical section. Use our new POSIX type!
|
|
* pthread.h (pthread_cond_init): Add function protoype.
(pthread_cond_broadcast): Likewise.
(pthread_cond_signal): Likewise.
(pthread_cond_timedwait): Likewise.
(pthread_cond_wait): Likewise.
(pthread_cond_destroy): Likewise.
(pthread_cond_t): Define this type.
|
|
* pthread.h (PTHREADS_PROCESS_PRIVATE): Remove.
(PTHREAD_PROCESS_SHARED): Likewise. No support for mutexes shared
across processes for now.
(pthread_mutex_t): Use a Win32 CRITICAL_SECTION type for better
performance.
|
|
* pthread.h (pthread_attr_init): Add function prototype.
(pthread_attr_destroy): Likewise.
(pthread_attr_setstacksize): Likewise.
(pthread_attr_getstacksize): Likewise.
(pthread_attr_setstackaddr): Likewise.
(pthread_attr_getstackaddr): Likewise.
|
|
* pthread.h (pthread_condattr_setpshared): Fix typo.
|
|
|
|
* pthread.h (pthread_condattr_t): Define this type.
(pthread_condattr_init): Likewise.
(pthread_condattr_destroy): Likewise.
(pthread_condattr_setpshared): Likewise.
(pthread_condattr_getpshared): Likewise.
|