summaryrefslogtreecommitdiff
path: root/nonportable.c
AgeCommit message (Collapse)Author
2004-11-22Copyright updaterpj
2004-05-17re-indentation, bug fixes, hooks for pre-emptive async cancelationrpj
2003-08-19Updated Copyright notice (date and contact address).rpj
2002-02-18Major reorganisation of source code; new routine and tests added.rpj
2002-02-11Splitting files. See ChangeLog file for details.rpj
2002-02-08Copyright notice updates; module splitting; POSIX versionrpj
conditional compilation; refinements; bug fixes. See the ChangeLog.
2002-02-07pthread_delay_np: Add missing "return(0)".rpj
2002-02-07 * nonportable.c (pthread_delay_np): Make a truerpj
cancelation point. Deferred cancels will interrupt the wait.
2002-01-312002-01-27 Ross Johnson <rpj@special.ise.canberra.edu.au>rpj
* mutex.c (pthread_mutex_timedlock): New function suggested by Alexander Terekhov. The logic required to implement this properly came from Alexander, with some collaboration with Thomas Pfaff. (pthread_mutex_unlock): Wrap the waiters check and sema post in a critical section to prevent a race with pthread_mutex_timedlock. (ptw32_timed_semwait): New function; returns a special result if the absolute timeout parameter represents a time already passed when called; used by pthread_mutex_timedwait(). Have deliberately not reused the name "ptw32_sem_timedwait" because they are not the same routine. * condvar.c (ptw32_cond_timedwait): Use the new sem_timedwait() instead of ptw32_sem_timedwait(), which now has a different function. See previous. * implement.h: Remove prototype for ptw32_sem_timedwait. See next. (pthread_mutex_t_): Add critical section element for access to lock_idx during mutex post-timeout processing. * semaphore.h (sem_timedwait): See next. * semaphore.c (sem_timedwait): See next. * private.c (ptw32_sem_timedwait): Move to semaphore.c and rename as sem_timedwait(). 2002-01-18 Ross Johnson <rpj@special.ise.canberra.edu.au> * sync.c (pthread_join): Was getting the exit code from the calling thread rather than the joined thread if defined(__MINGW32__) && !defined(__MSVCRT__). 2002-01-15 Ross Johnson <rpj@special.ise.canberra.edu.au> * pthread.h: Unless the build explicitly defines __CLEANUP_SEH, __CLEANUP_CXX, or __CLEANUP_C, then the build defaults to __CLEANUP_C style cleanup. This style uses setjmp/longjmp in the cancelation and thread exit implementations and therefore won't do stack unwinding if linked to applications that have it (e.g. C++ apps). This is currently consistent with most/all commercial Unix POSIX threads implementations. * spin.c (pthread_spin_init): Edit renamed function call. * nonportable.c (pthread_num_processors_np): New. (pthread_getprocessors_np): Renamed to ptw32_getprocessors and moved to private.c. * private.c (pthread_getprocessors): Moved here from nonportable.c. * pthread.def (pthread_getprocessors_np): Removed from export list. * rwlock.c (pthread_rwlockattr_init): New. (pthread_rwlockattr_destroy): New. (pthread_rwlockattr_getpshared): New. (pthread_rwlockattr_setpshared): New.
2001-12-18Include an interim complete Copyright notice in each source file;rpj
Remove unused autoconf files; Add the file COPYING, which describes the pthread-win32 license relative to the FSF LGPL.
2001-10-25 * GNUmakefile (libwsock32): Add to linker flags forrpj
WSAGetLastError() and WSASetLastError(). * Makefile (wsock32.lib): Likewise. * create.c: Minor mostly inert changes. * implement.h (PTW32_MAX): Move into here and renamed from sched.h. (PTW32_MIN): Likewise. * GNUmakefile (TEST_ICE): Define if testing internal implementation of InterlockedCompareExchange. * Makefile (TEST_ICE): Likewise. * private.c (TEST_ICE): Likewise.
2001-10-25 * barrier.c: Move _LONG and _LPLONG defines intorpj
implement.h; rename to PTW32_INTERLOCKED_LONG and PTW32_INTERLOCKED_LPLONG respectively. * spin.c: Likewise; ptw32_interlocked_compare_exchange used in place of InterlockedCompareExchange directly. * global.c (ptw32_interlocked_compare_exchange): Add prototype for this new routine pointer to be used when InterlockedCompareExchange isn't supported by Windows. * nonportable.c (pthread_win32_process_attach_np): Check for support of InterlockedCompareExchange in kernel32 and assign its address to ptw32_interlocked_compare_exchange if it exists, or our own ix86 specific implementation ptw32_InterlockedCompareExchange. *private.c (ptw32_InterlockedCompareExchange): An implementation of InterlockedCompareExchange() which is specific to ix86; written directly in assembler for either MSVC or GNU C; needed because Windows 95 doesn't support InterlockedCompareExchange(). * sched.c (sched_get_priority_min): Extend to return THREAD_PRIORITY_IDLE. (sched_get_priority_max): Extend to return THREAD_PRIORITY_CRITICAL.
2001-07-05Added new routines from POSIX 1003.1j. This is alpha level code.rpj
* 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.
2001-06-19 * Made organisational-only changes to UWIN additions.rpj
* dll.c (dllMain): Moved UWIN process attach code to pthread_win32_process_attach_np(); moved instance of pthread_count to global.c. * global.c (pthread_count): Moved from dll.c. * nonportable.c (pthread_win32_process_attach_np): Moved _UWIN code to here from dll.c. * implement.h (pthread_count): Define extern int. * create.c (pthread_count): Remove extern int. * private.c (pthread_count): Likewise. * exit.c (pthread_count): Likewise. Contributed by - David Korn <dgk@research.att.com> * dll.c: Added changes necessary to work with UWIN. * create.c: Likewise. * pthread.h: Likewise. * misc.c: Likewise. * exit.c: Likewise. * private.c: Likewise. * implement.h: Likewise. There is some room at the start of struct pthread_t_ to implement the signal semantics in UWIN's posix.dll although this is not yet complete. * Nmakefile: Compatible with UWIN's Nmake utility. * Nmakefile.tests: Likewise - for running the tests.
2001-06-05 * nonportable.c (pthread_mutex_setdefaultkind_np):rpj
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.
2001-05-312001-05-30 Ross Johnson <rpj@setup1.ise.canberra.edu.au>rpj
* 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-28./ChangeLog:rpj
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.
2000-09-02New. Contains non-portable routines.rpj