12012-03-18  Ross Johnson <ross dot johnson at homemail dot com dot au>
2
3	* create.c (pthread_create): add __cdecl attribute to thread routine
4	arg
5	* implement.h (pthread_key_t): add __cdecl attribute to destructor
6	element
7	(ThreadParms): likewise for start element
8	* pthread.h (pthread_create): add __cdecl to prototype start arg
9	(pthread_once): likewise for init_routine arg
10	(pthread_key_create): likewise for destructor arg
11	(ptw32_cleanup_push): replace type of routine arg with previously
12	defined ptw32_cleanup_callback_t
13	* pthread_key_create.c: add __cdecl attribute to destructor arg
14	* pthread_once.c: add __cdecl attribute to init_routine arg
15	* ptw32_threadStart.c (start): add __cdecl to start variable type
16
17
182011-07-06  Ross Johnson <ross dot johnson at homemail dot com dot au>
19
20	* pthread_cond_wait.c (pragma inline_depth): this is almost redundant
21	now nevertheless fixed thei controlling MSC_VER from "< 800" to
22	"< 1400" (i.e. any prior to VC++ 8.0).
23	* pthread_once.ci (pragma inline_depth): Likewise.
24	* pthread_rwlock_timedwrlock.ci (pragma inline_depth): Likewise.
25	* pthread_rwlock_wrlock.ci (pragma inline_depth): Likewise.
26	* sem_timedwait.ci (pragma inline_depth): Likewise.
27	* sem_wait.ci (pragma inline_depth): Likewise.
28
292011-07-05  Ross Johnson <ross dot johnson at homemail dot com dot au>
30
31	* pthread_win32_attach_detach_np.c: Use strncat_s if available
32	to removei a compile warning; MingW supports this routine but we
33	continue to use strncat anyway there because it is secure if
34	given the correct parameters; fix strncat param 3 to avoid
35	buffer overrun exploitation potential.
36
372011-07-03  Ross Johnson <ross dot johnson at homemail dot com dot au>
38
39	* pthread_spin_unlock.c (EPERM): Return success if unlocking a lock
40	that is not locked, because single CPU machines wrap a
41	PTHREAD_MUTEX_NORMAL mutex, which returns success in this case.
42	* pthread_win32_attach_detach_np.c (QUSEREX.DLL): Load from an
43	absolute path only which must be the Windows System folder.
44
452011-07-03 Daniel Richard G. <skunk at iskunk dot org>
46
47	* Makefile (_WIN32_WINNT): Removed; duplicate definition in
48	implement.h; more cleanup and enhancements.
49
502011-07-02 Daniel Richard G. <skunk at iskunk dot org>
51
52	* Makefile: Cleanups and implovements.
53	* ptw32_MCS_locks.c: Casting fixes.
54	* implement.h: Interlocked call and argument casting macro fixes
55	to support older and newer build environments.
56
572011-07-01  Ross Johnson <ross dot johnson at homemail dot com dot au>
58
59	* *.[ch] (PTW32_INTERLOCKED_*): Redo 23 and 64 bit versions of these
60	macros and re-apply in code to undo the incorrect changes from
61	2011-06-29; remove some size_t casts which should not be required
62	and may be problematic.a
63	There are now two sets of macros:
64	PTW32_INTERLOCKED_*_LONG which work only on 32 bit integer variables;
65	PTW32_INTERLOCKED_*_SIZE which work on size_t integer variables, i.e.
66	LONG for 32 bit systems and LONGLONG for 64 bit systems.
67	* implement.h (MCS locks): nextFlag and waitFlag are now HANDLE type.
68	* ptw32_MCS_locks.c: Likewise.
69	* pthread.h (#include <setjmp.h>): Removed.
70	* ptw32_throw.c (#include <setjmp.h>): Added.
71	* ptw32_threadStart.c (#include <setjmp.h>): Added.
72	* implement.h (#include <setjmp.h>): Added.
73
742011-06-30  Ross Johnson <ross dot johnson at homemail dot com dot au>
75
76	* pthread_once.c: Tighten 'if' statement casting; fix interlocked
77	pointer cast for 64 bit compatibility (missed yesterday); remove
78	the superfluous static cleanup routine and call the release routine
79	directly if popped.
80	* create.c (stackSize): Now type size_t.
81	* pthread.h (struct ptw32_thread_t_): Rearrange to fix element alignments.
82
832011-06-29 Daniel Richard G. <skunk at iskunk dot org>
84
85	* ptw32_relmillisecs.c (ftime):
86	  _ftime64_s() is only available in MSVC 2005 or later;
87	  _ftime64() is available in MinGW or MSVC 2002 or later;
88	  _ftime() is always available.
89	* pthread.h (long long): Not defined in older MSVC 6.
90	* implement.h (long long): Likewise.
91	* pthread_getunique_np.c (long long): Likewise.
92
932011-06-29  Ross Johnson <ross dot johnson at homemail dot com dot au>
94
95	* *.[ch] (PTW32_INTERLOCKED_*): These macros should now work for
96	both 32 and 64 bit builds. The MingW versions are all inlined asm
97	while the MSVC versions expand to their Interlocked* or Interlocked*64
98	counterparts appropriately. The argument type have also been changed
99	to cast to the appropriate value or pointer size for the architecture.
100
1012011-05-29  Ross Johnson <ross dot johnson at homemail dot com dot au>
102
103	* *.[ch] (#ifdef): Extended cleanup to whole project.
104
1052011-05-29 Daniel Richard G. <skunk at iskunk dot org>
106
107	* Makefile (CC): Define  CC to allow use of other compatible
108	compilers such as the Intel compilter icl.
109	* implement.h (#if): Fix forms like #if HAVE_SOMETHING.
110	* pthread.h: Likewise.
111	* sched.h: Likewise; PTW32_LEVEL_* becomes PTW32_SCHED_LEVEL_*.
112	* semaphore.h: Likewise.
113
1142011-05-11  Ross Johnson <ross.johnson at homemail.com.au>
115
116	* ptw32_callUserDestroyRoutines.c (terminate): Altered includes
117	to match ptw32_threadStart.c.
118	* GNUmakefile (GCE-inlined-debug, DOPT): Fixed.
119
1202011-04-31  Ross Johnson <ross.johnson at homemail.com.au>
121
122	* (robust mutexes): Added this API. The API is not
123	mandatory for implementations that don't support PROCESS_SHARED
124	mutexes, nevertheless it was considered useful both functionally
125	and for source-level compatibility.
126
1272011-03-26  Ross Johnson <ross.johnson at homemail.com.au>
128
129	* pthread_getunique_np.c: New non-POSIX interface for compatibility
130	with some other implementations; returns a 64 bit sequence number
131	that is unique to each thread in the process.
132	* pthread.h (pthread_getunique_np): Added.
133	* global.c: Add global sequence counter for above.
134	* implement.h: Likewise.
135
1362011-03-25  Ross Johnson <ross.johnson at homemail.com.au>
137
138	* (cancelLock): Convert to an MCS lock and rename to stateLock.
139	* (threadLock): Likewise.
140	* (keyLock): Likewise.
141	* pthread_mutex*.c: First working robust mutexes.
142
1432011-03-11  Ross Johnson <ross.johnson at homemail.com.au>
144
145	* implement.h (PTW32_INTERLOCKED_*CREMENT macros): increment/decrement
146	using ++/-- instead of add/subtract 1.
147	* ptw32_MCS_lock.c: Make casts consistent.
148
1492011-03-09  Ross Johnson <ross.johnson at homemail.com.au>
150
151	* implement.h (ptw32_thread_t_): Add process unique sequence number.
152	* global.c: Replace global Critical Section objects with MCS
153	queue locks.
154	* implement.h: Likewise.
155	* pthread_cond_destroy.c: Likewise.
156	* pthread_cond_init.c: Likewise.
157	* pthread_detach.c: Likewise.
158	* pthread_join.c: Likewise.
159	* pthread_kill.c: Likewise.
160	* pthread_mutex_destroy.c: Likewise.
161	* pthread_rwlock_destroy.c: Likewise.
162	* pthread_spin_destroy.c: Likewise.
163	* pthread_timechange_handler_np.c: Likewise.
164	* ptw32_cond_check_need_init.c: Likewise.
165	* ptw32_mutex_check_need_init.c: Likewise.
166	* ptw32_processInitialize.c: Likewise.
167	* ptw32_processTerminate.c: Likewise.
168	* ptw32_reuse.c: Likewise.
169	* ptw32_rwlock_check_need_init.c: Likewise.
170	* ptw32_spinlock_check_need_init.c: Likewise.
171
1722011-03-06  Ross Johnson <ross.johnson at homemail.com.au>
173
174	* several (MINGW64): Cast and call fixups for 64 bit compatibility;
175	clean build via x86_64-w64-mingw32 cross toolchain on Linux i686
176	targeting x86_64 win64.
177	* ptw32_threadStart.c (ptw32_threadStart): Routine no longer attempts
178	to pass [unexpected C++] exceptions out of scope but ends the thread
179	normally setting EINTR as the exit status.
180	* ptw32_throw.c: Fix C++ exception throwing warnings; ignore
181	informational warning.
182	* implement.h: Likewise with the corresponding header definition.
183
1842011-03-04  Ross Johnson <ross.johnson at homemail.com.au>
185
186	* implement.h (PTW32_INTERLOCKED_*): Mingw32 does not provide
187	the __sync_* intrinsics so implemented them here as macro
188	assembler routines. MSVS Interlocked* are emmitted as intrinsics
189	wherever possible, so we want mingw to match it; Extended to
190	include all interlocked routines used by the library; implemented
191	x86_64 versions also.
192	* ptw32_InterlockedCompareExchange.c: No code remaining here.
193	* ptw32_MCS_lock.c: Converted interlocked calls to use new macros.
194	* pthread_barrier_wait.c: Likewise.
195	* pthread_once.c: Likewise.
196	* ptw32_MCS_lock.c (ptw32_mcs_node_substitute): Name changed to
197	ptw32_mcs_node_transfer.
198
1992011-02-28  Ross Johnson <ross.johnson at homemail.com.au>
200
201	* ptw32_relmillisecs.c: If possible, use _ftime64_s or _ftime64
202	before resorting to _ftime.
203
2042011-02-27  Ross Johnson <ross.johnson at homemail.com.au>
205
206	* sched_setscheduler.c: Ensure the handle is closed after use.
207	* sched_getscheduler.c: Likewise.
208	* pthread.h: Remove POSIX compatibility macros; don't define
209	timespec if already defined.
210	* context.h: Changes for 64 bit.
211	* pthread_cancel.c: Likewise.
212	* pthread_exit.c: Likewise.
213	* pthread_spin_destroy.c: Likewise.
214	* pthread_timechange_handler_np.c: Likewise.
215	* ptw32_MCS_lock.c: Likewise; some of these changes may
216	not be compatible with pre Windows 2000 systems; reverse the order of
217	the includes.
218	* ptw32_threadStart.c: Likewise.
219	* ptw32_throw.c: Likewise.
220
2212011-02-13  Ross Johnson <ross.johnson at homemail.com.au>
222
223	* pthread_self: Add comment re returning 'nil' value to
224	indicate failure only to win32 threads that call us.
225	* pthread_attr_setstackaddr: Fix comments; note this
226	function and it's compliment are now removed from SUSv4.
227
2282011-02-12  Ross Johnson <ross.johnson at homemail.com.au>
229
230	README.NONPORTABLE: Record a description of an obvious
231	method for nulling/comparing/hashing pthread_t using a
232	union; plus and investigation of a change of type for
233	pthread_t (to a union) to neutralise any padding bits and
234	bytes if they occur in pthread_t (the current pthread_t struct
235	does not contain padding AFAIK, but porting the library to a
236	future architecture may introduce them). Padding affects
237	byte-by-byte copies and compare operations.
238
2392010-11-16  Ross Johnson <ross.johnson at homemail.com.au>
240
241	* ChangeLog: Add this entry ;-)
242	Restore entries from 2007 through 2009 that went missing
243	at the last update.
244
2452010-06-19  Ross Johnson <ross.johnson at homemail.com.au>
246
247	* ptw32_MCS_lock.c (ptw32_mcs_node_substitute): Fix variable
248	names to avoid using C++ keyword ("new").
249	* implement.h (ptw32_mcs_node_substitute): Likewise.
250	* pthread_barrier_wait.c: Fix signed/unsigned comparison warning.
251
2522010-06-18  Ramiro Polla  <ramiro.polla at gmail.com >
253
254	* autostatic.c: New file; call pthread_win32_process_*()
255	libary init/cleanup routines automatically on application start
256	when statically linked.
257	* pthread.c (autostatic.c): Included.
258	* pthread.h (declspec): Remove import/export defines if compiler
259	is MINGW.
260	* sched.h (declspec): Likewise.
261	* semaphore.h (declspec): Likewise.
262	* need_errno.h (declspec): Likewise.
263	* Makefile (autostatic.obj): Add for small static builds.
264	* GNUmakefile (autostatic.o): Likewise.
265	* NEWS (Version 2.9.0): Add changes.
266	* README.NONPORTABLE (pthread_win32_process_*): Update
267	description.
268
2692010-06-15  Ramiro Polla  <ramiro.polla at gmail.com >
270
271	* Makefile: Remove linkage with the winsock library by default.
272	* GNUmakefile: Likewise.
273	* pthread_getspecific.c: Likewise by removing calls to WSA
274	functions.
275	* config.h (RETAIN_WSALASTERROR): Can be defined if necessary.
276
2772010-01-26  Ross Johnson <ross.johnson at homemail.com.au>
278
279	* ptw32_MCS_lock.c (ptw32_mcs_node_substitute): New routine
280	to allow relocating the lock owners thread-local node to somewhere
281	else, e.g. to global space so that another thread can release the
282	lock. Used in pthread_barrier_wait.
283	(ptw32_mcs_lock_try_acquire): New routine.
284	* pthread_barrier_init: Only one semaphore is used now.
285	* pthread_barrier_wait: Added an MCS guard lock with the last thread
286	to leave the barrier releasing the lock. This removes a deadlock bug
287	observed when there are greater than barrier-count threads
288	attempting to cross.
289	* pthread_barrier_destroy: Added an MCS guard lock.
290
2912009-03-03  Stephan O'Farrill <stephan dot ofarrill at gmail dot com>
292
293	* pthread_attr_getschedpolicy.c: Add "const" to function parameter
294	in accordance with SUSv3 (POSIX).
295	* pthread_attr_getinheritsched.c: Likewise.
296	* pthread_mutexattr_gettype.c: Likewise.
297
2982008-06-06  Robert Kindred  <RKindred at SwRI dot edu>
299
300	* ptw32_throw.c (ptw32_throw): Remove possible reference to NULL
301	pointer. (At the same time made the switch block conditionally
302	included only if exitCode is needed - RPJ.)
303	* pthread_testcancel.c (pthread_testcancel): Remove duplicate and
304	misplaced pthread_mutex_unlock().
305
3062008-02-21  Sebastian Gottschalk  <seppig_relay at gmx dot de>
307
308	* pthread_attr_getdetachstate.c (pthread_attr_getdetachstate):
309	Remove potential and superfluous null pointer assignment.
310
3112007-11-22  Ivan Pizhenko  <ivanp4 at ua dot fm>
312
313	* pthread.h (gmtime_r): gmtime returns 0 if tm represents a time
314	prior to 1/1/1970. Notice this to prevent raising an exception.
315	* pthread.h (localtime_r): Likewise for localtime.
316
3172007-07-14  Marcel Ruff  <mr at marcelruff dot info>
318
319	* errno.c (_errno): Fix test for pthread_self() success.
320	* need_errno.h: Remove unintentional line wrap from #if line.
321
3222007-07-14  Mike Romanchuk  <mromanchuk at empirix dot com>
323
324	* pthread.h (timespec): Fix tv_sec type.
325
3262007-01-07  Sinan Kaya <sinan.kaya at siemens dot com>
327
328	* need_errno.h: Fix declaration of _errno - the local version of
329	_errno() is used, e.g. by WinCE.
330
3312007-01-06  Ross Johnson <ross.johnson at homemail dot com dot au>
332
333	* ptw32_semwait.c: Add check for invalid sem_t after acquiring the
334	sem_t state guard mutex and before affecting changes to sema state.
335
3362007-01-06  Marcel Ruff <mr at marcelruff dot info>
337
338	* error.c: Fix reference to pthread handle exitStatus member for
339	builds that use NEED_ERRNO (i.e. WINCE).
340	* context.h: Add support for ARM processor (WinCE).
341	* mutex.c (process.h): Exclude for WINCE.
342	* create.c: Likewise.
343	* exit.c: Likewise.
344	* implement.h: Likewise.
345	* pthread_detach.c (signal.h): Exclude for WINCE.
346	* pthread_join.c: Likewise.
347	* pthread_kill.c: Likewise.
348	* pthread_rwlock_init.c (errno.h): Remove - included by pthread.h.
349	* pthread_rwlock_destroy.c: Likewise.
350	* pthread_rwlock_rdlock.c: Likewise.
351	* pthread_rwlock_timedrdlock.c: Likewise.
352	* pthread_rwlock_timedwrlock.c: Likewise.
353	* pthread_rwlock_tryrdlock.c: Likewise.
354	* pthread_rwlock_trywrlock.c: likewise.
355	* pthread_rwlock_unlock.c: Likewise.
356	* pthread_rwlock_wrlock.c: Likewise.
357	* pthread_rwlockattr_destroy.c: Likewise.
358	* pthread_rwlockattr_getpshared.c: Likewise.
359	* pthread_rwlockattr_init.c: Likewise.
360	* pthread_rwlockattr_setpshared.c: Likewise.
361
3622007-01-06  Romano Paolo Tenca <rotenca at telvia dot it>
363
364	* pthread_cond_destroy.c: Replace sem_wait() with non-cancelable
365	ptw32_semwait() since pthread_cond_destroy() is not a cancelation
366	point.
367	* implement.h (ptw32_spinlock_check_need_init): Add prototype.
368	* ptw32_MCS_lock.c: Reverse order of includes.
369
3702007-01-06  Eric Berge <eric dot berge at quantum dot com>
371
372	* pthread_cond_destroy.c: Add LeaveCriticalSection before returning
373	after errors.
374
3752007-01-04  Ross Johnson <ross.johnson at homemail dot com dot au>
376
377	* ptw32_InterlockedCompareExchange.c: Conditionally skip for
378	Win64 as not required.
379	* pthread_win32_attach_detach_np.c (pthread_win32_process_attach_np):
380	Test for InterlockedCompareExchange is not required for Win64.
381	* context.h: New file. Included by pthread_cancel.h and any tests
382	that need it (e.g. context1.c).
383	* pthread_cancel.c: Architecture-dependent context macros moved
384	to context.h.
385
3862007-01-04  Kip Streithorst <KSTREITH at ball dot com>
387
388	* implement.h (PTW32_INTERLOCKED_COMPARE_EXCHANGE): Add Win64
389	support.
390
3912006-12-20  Ross Johnson <ross.johnson at homemail.com.au>
392
393	* sem_destroy.c: Fix the race involving invalidation of the sema;
394	fix incorrect return of EBUSY resulting from the mutex trylock
395	on the private mutex guard.
396	* sem_wait.c: Add check for invalid sem_t after acquiring the
397	sem_t state guard mutex and before affecting changes to sema state.
398	* sem_trywait.c: Likewise.
399	* sem_timedwait.c: Likewise.
400	* sem_getvalue.c: Likewise.
401	* sem_post.c: Similar.
402	* sem_post_multiple.c: Likewise.
403	* sem_init.c: Set max Win32 semaphore count to SEM_VALUE_MAX (was
404	_POSIX_SEM_VALUE_MAX, which is a lower value - the minimum).
405
406	* pthread_win32_attach_detach_np.c (pthread_win32_process_attach_np):
407	Load COREDLL.DLL under WINCE to check existence of
408	InterlockedCompareExchange() routine. This used to be done to test
409	for TryEnterCriticalSection() but was removed when this was no
410	longer needed.
411
4122006-01-25  Prashant Thakre <prashant.thakre at gmail.com>
413
414	* pthread_cancel.c: Added _M_IA64 register context support.
415
4162005-05-13  Ross Johnson  <ross at callisto.canberra.edu.au>
417
418	* pthread_kill.c (pthread_kill): Remove check for Win32 thread
419	priority (to confirm HANDLE validity). Useless since thread HANDLEs
420	a not recycle-unique.
421
4222005-05-30  Vladimir Kliatchko  <vladimir at kliatchko.com>
423
424	* pthread_once.c: Re-implement using an MCS queue-based lock. The form
425	of pthread_once is as proposed by Alexander Terekhov (see entry of
426	2005-03-13). The MCS lock implementation does not require a unique
427	'name' to identify the lock between threads. Attempts to get the Event
428	or Semaphore based versions of pthread_once to a satisfactory level
429	of robustness have thus far failed. The last problem (avoiding races
430	involving non recycle-unique Win32 HANDLEs) was giving everyone
431	grey hair trying to solve it.
432
433	* ptw32_MCS_lock.c: New MCS queue-based lock implementation. These
434	locks are efficient: they have very low overhead in the uncontended case;
435	are efficient in contention and minimise cache-coherence updates in
436	managing the user level FIFO queue; do not require an ABI change in the
437	library.
438
4392005-05-27  Alexander Gottwald <alexander.gottwald at s1999.tu-chemnitz.de>
440
441	* pthread.h: Some things, like HANDLE, were only defined if
442	PTW32_LEVEL was >= 3. They should always be defined.
443
4442005-05-25  Vladimir Kliatchko  <vladimir at kliatchko.com>
445
446	* pthread_once.c: Eliminate all priority operations and other
447	complexity by replacing the event with a semaphore. The advantage
448	of the change is the ability to release just one waiter if the
449	init_routine thread is cancelled yet still release all waiters when
450	done. Simplify once_control state checks to improve efficiency
451	further.
452
4532005-05-24  Mikael Magnusson  <mikaelmagnusson at glocalnet.net>
454
455	* GNUmakefile: Patched to allow cross-compile with mingw32 on Linux.
456	It uses macros instead of referencing dlltool, gcc and g++ directly;
457	added a call to ranlib. For example the GC static library can be
458	built with:
459	make CC=i586-mingw32msvc-gcc RC=i586-mingw32msvc-windres \
460	RANLIB=i586-mingw32msvc-ranlib clean GC-static
461
4622005-05-13  Ross Johnson  <ross at callisto.canberra.edu.au>
463
464	* pthread_win32_attach_detach_np.c (pthread_win32_thread_detach_np):
465	Move on-exit-only stuff from ptw32_threadDestroy() to here.
466	* ptw32_threadDestroy.c: It's purpose is now only to reclaim thread
467	resources for detached threads, or via pthread_join() or
468	pthread_detach() on joinable threads.
469	* ptw32_threadStart.c: Calling user destruct routines has moved to
470	pthread_win32_thread_detach_np(); call pthread_win32_thread_detach_np()
471	directly if statically linking, otherwise do so via dllMain; store
472	thread return value in thread struct for all cases, including
473	cancellation and exception exits; thread abnormal exits	go via
474	pthread_win32_thread_detach_np.
475	* pthread_join.c (pthread_join): Don't try to get return code from
476	Win32 thread - always get it from he thread struct.
477	* pthread_detach.c (pthread_detach): reduce extent of the thread
478	existence check since we now don't care if the Win32 thread HANDLE has
479	been closed; reclaim thread resources if the thread has exited already.
480	* ptw32_throw.c (ptw32_throw): For Win32 threads that are not implicit,
481	only Call thread cleanup if statically linking, otherwise leave it to
482	dllMain.
483	* sem_post.c (_POSIX_SEM_VALUE_MAX): Change to SEM_VALUE_MAX.
484	* sem_post_multiple.c: Likewise.
485	* sem_init.c: Likewise.
486
4872005-05-10  Ross Johnson  <ross at callisto.canberra.edu.au>
488
489	* pthread_join.c (pthread_join): Add missing check for thread ID
490	reference count in thread existence test; reduce extent of the
491	existence test since we don't care if the Win32 thread HANDLE has
492	been closed.
493
4942005-05-09  Ross Johnson  <ross at callisto.canberra.edu.au>
495
496	* ptw32_callUserDestroyRoutines.c: Run destructor process (i.e.
497	loop over all keys calling destructors) up to
498	PTHREAD_DESTRUCTOR_ITERATIONS times if TSD value isn't NULL yet;
499	modify assoc management.
500	* pthread_key_delete.c: Modify assoc management.
501	* ptw32_tkAssocDestroy.c: Fix error in assoc removal from chains.
502	* pthread.h
503	(_POSIX_THREAD_DESTRUCTOR_ITERATIONS): Define to value specified by
504	POSIX.
505	(_POSIX_THREAD_KEYS_MAX): Define to value specified by POSIX.
506	(PTHREAD_KEYS_MAX): Redefine [upward] to minimum required by POSIX.
507	(SEM_NSEMS_MAX): Define to implementation value.
508	(SEM_VALUE_MAX): Define to implementation value.
509	(_POSIX_SEM_NSEMS_MAX): Redefine to value specified by POSIX.
510	(_POSIX_SEM_VALUE_MAX): Redefine to value specified by POSIX.
511
5122005-05-06  Ross Johnson  <ross at callisto.canberra.edu.au>
513
514	* signal.c (sigwait): Add a cancellation point to this otherwise
515	no-op.
516	* sem_init.c (sem_init): Check for and return ERANGE error.
517	* sem_post.c (sem_post): Likewise.
518	* sem_post_multiple.c (sem_post_multiple): Likewise.
519	* manual (directory): Added; see ChangeLog inside.
520
5212005-05-02  Ross Johnson  <ross at callisto.canberra.edu.au>
522
523	* implement.h (struct pthread_key_t_): Change threadsLock to keyLock
524	so as not to be confused with the per thread lock 'threadlock';
525	change all references to it.
526	* implement.h (struct ThreadKeyAssoc): Remove lock; add prevKey
527	and prevThread pointers; re-implemented all routines that use this
528	struct. The effect of this is to save one handle per association,
529	which could potentially equal the number of keys multiplied by the
530	number of threads, accumulating over time - and to free the
531	association memory as soon as it is no longer referenced by either
532	the key or the thread. Previously, the handle and memory were
533	released only after BOTH key and thread no longer referenced the
534	association. That is, often no association resources were released
535	until the process itself exited. In addition, at least one race
536	condition has been removed - where two threads could attempt to
537	release the association resources simultaneously - one via
538	ptw32_callUserDestroyRoutines and the other via
539	pthread_key_delete.
540	- thanks to Richard Hughes at Aculab for discovering the problem.
541	* pthread_key_create.c: See above.
542	* pthread_key_delete.c: See above.
543	* pthread_setspecific.c: See above.
544	* ptw32_callUserDestroyRoutines.c: See above.
545	* ptw32_tkAssocCreate.c: See above.
546	* ptw32_tkAssocDestroy.c: See above.
547
5482005-04-27  Ross Johnson  <ross at callisto.canberra.edu.au>
549
550	* sem_wait.c (ptw32_sem_wait_cleanup): after cancellation re-attempt
551	to acquire the semaphore to avoid a race with a late sem_post.
552	* sem_timedwait.c: Modify comments.
553
5542005-04-25  Ross Johnson  <ross at callisto.canberra.edu.au>
555
556	* ptw32_relmillisecs.c: New module; converts future abstime to
557	milliseconds relative to 'now'.
558	* pthread_mutex_timedlock.c: Use new ptw32_relmillisecs routine in
559	place of internal code; remove the NEED_SEM code - this routine is now
560	implemented for builds that define NEED_SEM (WinCE etc)
561	* sem_timedwait.c: Likewise; after timeout or cancellation,
562	re-attempt to acquire the semaphore in case one has been posted since
563	the timeout/cancel occurred. Thanks to Stefan Mueller.
564	* Makefile: Add ptw32_relmillisecs.c module; remove
565	ptw32_{in,de}crease_semaphore.c modules.
566	* GNUmakefile: Likewise.
567	* Bmakefile: Likewise.
568
569	* sem_init.c: Re-write the NEED_SEM code to be consistent with the
570	non-NEED_SEM code, but retaining use of an event in place of the w32 sema
571	for w32 systems that don't include semaphores (WinCE);
572	the NEED_SEM versions of semaphores has been broken for a long time but is
573	now fixed and supports all of the same routines as the non-NEED_SEM case.
574	* sem_destroy.c: Likewise.
575	* sem_wait.c: Likewise.
576	* sem_post.c: Likewise.
577	* sem_post_multple.c: Likewise.
578	* implement.h: Likewise.
579	* sem_timedwait.c: Likewise; this routine is now
580	implemented for builds that define NEED_SEM (WinCE etc).
581	* sem_trywait.c: Likewise.
582	* sem_getvalue.c: Likewise.
583
584	* pthread_once.c: Yet more changes, reverting closer to Gottlob Frege's
585	first design, but retaining cancellation, priority boosting, and adding
586	preservation of W32 error codes to make pthread_once transparent to
587	GetLastError.
588
5892005-04-11  Ross Johnson  <ross at callisto.canberra.edu.au>
590
591	* pthread_once.c (pthread_once): Added priority boosting to
592	solve starvation problem after once_routine cancellation.
593	See notes in file.
594
5952005-04-06  Kevin Lussier <Kevin at codegreennetworks.com>
596
597	* Makefile: Added debug targets for all versions of the library.
598
5992005-04-01  Ross Johnson  <ross at callisto.canberra.edu.au>
600
601	* GNUmakefile: Add target to build libpthreadGC1.a as a static link
602	library.
603	* Makefile: Likewise for pthreadGC1.lib.
604
6052005-04-01  Kevin Lussier <Kevin at codegreennetworks.com>
606
607	* sem_timedwait.c (sem_timedwait): Increase size of temp variables to
608	avoid int overflows for large timeout values.
609	* implement.h (int64_t): Include or define.
610
6112005-03-31   Dimitar Panayotov <develop at mail.bg>^M
612
613	* pthread.h: Fix conditional defines for static linking.
614	* sched.h: Liekwise.
615	* semaphore.h: Likewise.
616	* dll.c (PTW32_STATIC_LIB): Module is conditionally included
617	in the build.
618
6192005-03-16  Ross Johnson  <ross at callisto.canberra.edu.au>^M
620
621	* pthread_setcancelstate.c: Undo the last change.
622
6232005-03-16  Ross Johnson  <ross at callisto.canberra.edu.au>^M
624
625	* pthread_setcancelstate.c: Don't check for an async cancel event
626	if the library is using alertable async cancel..
627
6282005-03-14  Ross Johnson  <ross at callisto.canberra.edu.au>
629
630	* pthread_once.c (pthread_once): Downgrade interlocked operations to simple
631	memory operations where these are protected by the critical section; edit
632	comments.
633
6342005-03-13  Ross Johnson  <rpj at callisto.canberra.edu.au>
635
636	* pthread_once.c (pthread_once): Completely redesigned; a change was
637	required to the ABI (pthread_once_t_), and resulting in a version
638	compatibility index increment.
639
640	NOTES:
641	The design (based on pseudo code contributed by Gottlob Frege) avoids
642	creating a kernel object if there is no contention. See URL for details:-
643	http://sources.redhat.com/ml/pthreads-win32/2005/msg00029.html
644	This uses late initialisation similar to the technique already used for
645	pthreads-win32 mutexes and semaphores (from Alexander Terekhov).
646
647	The subsequent cancelation cleanup additions (by rpj) could not be implemented
648	without sacrificing some of the efficiency in Gottlob's design. In particular,
649	although each once_control uses it's own event to block on, a global CS is
650	required to manage it - since the event must be either re-usable or
651	re-creatable under cancelation. This is not needed in the non-cancelable
652	design because it is able to mark the event as closed (forever).
653
654	When uncontested, a CS operation is equivalent to an Interlocked operation
655	in speed. So, in the final design with cancelability, an uncontested
656	once_control operation involves a minimum of five interlocked operations
657	(including the LeaveCS operation).
658
659	ALTERNATIVES:
660	An alternative design from Alexander Terekhov proposed using a named mutex,
661	as sketched below:-
662
663	  if (!once_control) { // May be in TLS
664	    named_mutex::guard guard(&once_control2);
665	      if (!once_control2) {
666	         <init>
667	         once_control2 = true;
668	      }
669	    once_control = true;
670	  }
671
672	A more detailed description of this can be found here:-
673	http://groups.yahoo.com/group/boost/message/15442
674
675	[Although the definition of a suitable PTHREAD_ONCE_INIT precludes use of the
676	TLS located flag, this is not critical.]
677
678	There are three primary concerns though:-
679	1) The [named] mutex is 'created' even in the uncontended case.
680	2) A system wide unique name must be generated.
681	3) Win32 mutexes are VERY slow even in the uncontended 	case. An uncontested
682	Win32 mutex lock operation can be 50 (or more) times slower than an
683	uncontested EnterCS operation.
684
685	Ultimately, the named mutex trick is making use of the global locks maintained
686	by the kernel.
687
688	* pthread.h (pthread_once_t_): One flag and an event HANDLE added.
689	(PTHREAD_ONCE_INIT): Additional values included.
690
6912005-03-08  Ross Johnson  <rpj at callisto.canberra.edu.au>
692
693	* pthread_once.c (pthread_once): Redesigned to elliminate potential
694	starvation problem.
695	- reported by Gottlob Frege  <gottlobfrege at gmail.com>
696
697	* ptw32_threadDestroy.c (ptw32_threadDestroy): Implicit threads were
698	not closing their Win32 thread duplicate handle.
699	- reported by Dmitrii Semii <bogolt at gmail.com>
700
7012005-01-25  Ralf Kubis  <RKubis at mc.com>
702
703	* Attempted acquisition of recursive mutex was causing waiting
704	threads to not be woken when the mutex is released.
705
706	* GNUmakefile (GCE): Generate correct version resource comments.
707
7082005-01-01  Konstantin Voronkov  <beowinkle at yahoo.com>
709
710	* pthread_mutex_lock.c (pthread_mutex_lock): The new atomic exchange
711	mutex algorithm is known to allow a thread to steal the lock off
712	FIFO waiting threads. The next waiting FIFO thread gets a spurious
713	wake-up and must attempt to re-acquire the lock. The woken thread
714	was setting itself as the mutex's owner before the re-acquisition.
715
7162004-11-22  Ross Johnson  <rpj at callisto.canberra.edu.au>
717
718	* pthread_cond_wait.c (ptw32_cond_wait_cleanup): Undo change
719	from 2004-11-02.
720	* Makefile (DLL_VER): Added for DLL naming suffix - see README.
721	* GNUmakefile (DLL_VER): Likewise.
722	* Wmakefile (DLL_VER): Likewise.
723	* Bmakefile (DLL_VER): Likewise.
724	* pthread.dsw (version.rc): Added to MSVS workspace.
725
7262004-11-20  Boudewijn Dekker  <b.dekker at ellipsis.nl>
727
728	* pthread_getspecific.c (pthread_getspecific): Check for
729	invalid (NULL) key argument.
730
7312004-11-19  Ross Johnson  <rpj at callisto.canberra.edu.au>
732
733	* config.h (PTW32_THREAD_ID_REUSE_INCREMENT): Added to allow
734	building the library for either unique thread IDs like Solaris
735	or non-unique thread IDs like Linux; allows application developers
736	to override the library's default insensitivity to some apps
737	that may not be strictly POSIX compliant.
738	* version.rc: New resource module to encode version information
739	within the DLL.
740	* pthread.h: Added PTW32_VERSION* defines and grouped sections
741	required by resource compiler together; bulk of file is skipped
742	if RC_INVOKED. Defined some error numbers and other names for
743	Borland compiler.
744
7452004-11-02  Ross Johnson  <rpj at callisto.canberra.edu.au>
746
747	* pthread_cond_wait.c (ptw32_cond_wait_cleanup): Lock CV mutex at
748	start of cleanup handler rather than at the end.
749	* implement.h (PTW32_THREAD_REUSE_EMPTY): Renamed from *_BOTTOM.
750	(ptw32_threadReuseBottom): New global variable.
751	* global.c (ptw32_threadReuseBottom): Declare new variable.
752	* ptw32_reuse.c (ptw32_reuse): Change reuse LIFO stack to LILO queue
753	to more evenly distribute use of reusable thread IDs; use renamed
754	PTW32_THREAD_REUSE_EMPTY.
755	* ptw32_processTerminate.c (ptw2_processTerminate): Use renamed
756	PTW32_THREAD_REUSE_EMPTY.
757
7582004-10-31  Ross Johnson  <rpj at callisto.canberra.edu.au>
759
760	* implement.h (PThreadState): Add new state value
761	'PThreadStateCancelPending'.
762	* pthread_testcancel.c (pthread_testcancel): Use new thread
763	'PThreadStateCancelPending' state as short cut to avoid entering
764	kernel space via WaitForSingleObject() call. This was obviated
765	by user space sema acquisition in sem_wait() and sem_timedwait(),
766	which are also cancelation points. A call to pthread_testcancel()
767	was required, which introduced a kernel call, effectively nullifying
768	any gains made by the user space sem acquisition checks.
769	* pthread_cancel.c (pthread_cancel): Set new thread
770	'PThreadStateCancelPending' state.
771
7722004-10-29  Ross Johnson  <rpj at callisto.canberra.edu.au>
773
774	* implement.h (pthread_t): Renamed to ptw32_thread_t; struct contains
775	all thread state.
776	* pthread.h (ptw32_handle_t): New general purpose struct to serve
777	as a handle for various reusable object IDs - currently only used
778	by pthread_t; contains a pointer to ptw32_thread_t (thread state)
779	and a general purpose uint for use as a reuse counter or flags etc.
780	(pthread_t): typedef'ed to ptw32_handle_t; the uint is the reuse
781	counter that allows the library to maintain unique POSIX thread IDs.
782	When the pthread struct reuse stack was introduced, threads would
783	often acquire an identical ID to a previously destroyed thread. The
784	same was true for the pre-reuse stack library, by virtue of pthread_t
785	being the address of the thread struct. The new pthread_t retains
786	the reuse stack but provides virtually unique thread IDs.
787	* sem_wait.c (ptw32_sem_wait_cleanup): New routine used for
788	cancelation cleanup.
789	* sem_timedwait.c (ptw32_sem_timedwait_cleanup): Likewise.
790
7912004-10-22  Ross Johnson  <rpj at callisto.canberra.edu.au>
792
793	* sem_init.c (sem_init): Introduce a 'lock' element in order to
794	replace the interlocked operations with conventional serialisation.
795	This is needed in order to be able to atomically modify the sema
796	value and perform Win32 sema release operations. Win32 semaphores are
797	used instead of events in order to support efficient multiple posting.
798	If the whole modify/release isn't atomic, a race between
799	sem_timedwait() and sem_post() could result in a release when there is
800	no waiting semaphore, which would cause too many threads to proceed.
801	* sem_wait.c (sem_wait): Use new 'lock'element.
802	* sem_timedwait.c (sem_timedwait): Likewise.
803	* sem_trywait.c (sem_trywait): Likewise.
804	* sem_post.c (sem_post): Likewise.
805	* sem_post_multiple.c (sem_post_multiple): Likewise.
806	* sem_getvalue.c (sem_getvalue): Likewise.
807	* ptw32_semwait.c (ptw32_semwait): Likewise.
808	* sem_destroy.c (sem_destroy): Likewise; also tightened the conditions
809	for semaphore destruction; in particular, a semaphore will not be
810	destroyed if it has waiters.
811	* sem_timedwait.c (sem_timedwait): Added cancel cleanup handler to
812	restore sema value when cancelled.
813	* sem_wait.c (sem_wait): Likewise.
814
8152004-10-21  Ross Johnson  <rpj at callisto.canberra.edu.au>
816
817	* pthread_mutex_unlock.c (pthread_mutex_unlock): Must use PulseEvent()
818	rather than SetEvent() to reset the event if there are no waiters.
819
8202004-10-19  Ross Johnson  <rpj at callisto.canberra.edu.au>
821
822	* sem_init.c (sem_init): New semaphore model based on the same idea
823	as mutexes, i.e. user space interlocked check to avoid
824	unnecessarily entering kernel space. Wraps the Win32 semaphore and
825	keeps it's own counter. Although the motivation to do this has existed
826	for a long time, credit goes to Alexander Terekhov for providing
827	the logic. I have deviated slightly from AT's logic to add the waiters
828	count, which has made the code more complicated by adding cancelation
829	cleanup. This also appears to have broken the VCE (C++ EH) version of
830	the library (the same problem as previously reported - see BUGS #2),
831	only apparently not fixable using the usual workaround, nor by turning
832	all optimisation off. The GCE version works fine, so it is presumed to
833	be a bug in MSVC++ 6.0. The cancelation exception is thrown and caught
834	correctly, but the cleanup class destructor is never called. The failing
835	test is tests\semaphore4.c.
836	* sem_wait.c (sem_wait): Implemented user space check model.
837	* sem_post.c (sem_post): Likewise.
838	* sem_trywait.c (sem_trywait): Likewise.
839	* sem_timedwait.c (sem_timedwait): Likewise.
840	* sem_post_multiple.c (sem_post_multiple): Likewise.
841	* sem_getvalue.c (sem_getvalue): Likewise.
842	* ptw32_semwait.c (ptw32_semwait): Likewise.
843	* implement.h (sem_t_): Add counter element.
844
8452004-10-15  Ross Johnson  <rpj at callisto.canberra.edu.au>
846
847	* implement.h (pthread_mutex_t_): Use an event in place of
848	the POSIX semaphore.
849	* pthread_mutex_init.c: Create the event; remove semaphore init.
850	* pthread_mutex_destroy.c: Delete the event.
851	* pthread_mutex_lock.c: Replace the semaphore wait with the event wait.
852	* pthread_mutex_trylock.c: Likewise.
853	* pthread_mutex_timedlock.c: Likewise.
854	* pthread_mutex_unlock.c: Set the event.
855
8562004-10-14  Ross Johnson  <rpj at callisto.canberra.edu.au>
857
858	* pthread_mutex_lock.c (pthread_mutex_lock): New algorithm using
859	Terekhov's xchg based variation of Drepper's cmpxchg model.
860	Theoretically, xchg uses fewer clock cycles than cmpxchg (using IA-32
861	as a reference), however, in my opinion bus locking dominates the
862	equation on smp systems, so the model with the least number of bus
863	lock operations in the execution path should win, which is Terekhov's
864	variant. On IA-32 uni-processor systems, it's faster to use the
865	CMPXCHG instruction without locking the bus than to use the XCHG
866	instruction, which always locks the bus. This makes the two variants
867	equal for the non-contended lock (fast lane) execution path on up
868	IA-32. Testing shows that the xchg variant is faster on up IA-32 as
869	well if the test forces higher lock contention frequency, even though
870	kernel calls should be dominating the times (on up IA-32, both
871	variants used CMPXCHG instructions and neither locked the bus).
872	* pthread_mutex_timedlock.c pthread_mutex_timedlock(): Similarly.
873	* pthread_mutex_trylock.c (pthread_mutex_trylock): Similarly.
874	* pthread_mutex_unlock.c (pthread_mutex_unlock): Similarly.
875	* ptw32_InterlockedCompareExchange.c (ptw32_InterlockExchange): New
876	function.
877	(PTW32_INTERLOCKED_EXCHANGE): Sets up macro to use inlined
878	ptw32_InterlockedExchange.
879	* implement.h (PTW32_INTERLOCKED_EXCHANGE): Set default to
880	InterlockedExchange().
881	* Makefile: Building using /Ob2 so that asm sections within inline
882	functions are inlined.
883
8842004-10-08  Ross Johnson  <rpj at callisto.canberra.edu.au>
885
886	* pthread_mutex_destroy.c (pthread_mutex_destroy): Critical Section
887	element is no longer required.
888	* pthread_mutex_init.c (pthread_mutex_init): Likewise.
889	* pthread_mutex_lock.c (pthread_mutex_lock): New algorithm following
890	Drepper's paper at http://people.redhat.com/drepper/futex.pdf, but
891	using the existing semaphore in place of the futex described in the
892	paper. Idea suggested by Alexander Terekhov - see:
893	http://sources.redhat.com/ml/pthreads-win32/2003/msg00108.html
894	* pthread_mutex_timedlock.c pthread_mutex_timedlock(): Similarly.
895	* pthread_mutex_trylock.c (pthread_mutex_trylock): Similarly.
896	* pthread_mutex_unlock.c (pthread_mutex_unlock): Similarly.
897	* pthread_barrier_wait.c (pthread_barrier_wait): Use inlined version
898	of InterlockedCompareExchange() if possible - determined at
899	build-time.
900	* pthread_spin_destroy.c pthread_spin_destroy(): Likewise.
901	* pthread_spin_lock.c pthread_spin_lock():Likewise.
902	* pthread_spin_trylock.c (pthread_spin_trylock):Likewise.
903	* pthread_spin_unlock.c (pthread_spin_unlock):Likewise.
904	* ptw32_InterlockedCompareExchange.c: Sets up macro for inlined use.
905	* implement.h (pthread_mutex_t_): Remove Critical Section element.
906	(PTW32_INTERLOCKED_COMPARE_EXCHANGE): Set to default non-inlined
907	version of InterlockedCompareExchange().
908	* private.c: Include ptw32_InterlockedCompareExchange.c first for
909	inlining.
910	* GNUmakefile: Add commandline option to use inlined
911	InterlockedCompareExchange().
912	* Makefile: Likewise.
913
9142004-09-27  Ross Johnson  <rpj at callisto.canberra.edu.au>
915
916	* pthread_mutex_lock.c (pthread_mutex_lock): Separate
917	PTHREAD_MUTEX_NORMAL logic since we do not need to keep or check some
918	state required by other mutex types; do not check mutex pointer arg
919	for validity - leave this to the system since we are only checking
920	for NULL pointers. This should improve speed of NORMAL mutexes and
921	marginally improve speed of other type.
922	* pthread_mutex_trylock.c (pthread_mutex_trylock): Likewise.
923	* pthread_mutex_unlock.c (pthread_mutex_unlock): Likewise; also avoid
924	entering the critical section for the no-waiters case, with approx.
925	30% reduction in lock/unlock overhead for this case.
926	* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise; also
927	no longer keeps mutex if post-timeout second attempt succeeds - this
928	will assist applications that wish to impose strict lock deadlines,
929	rather than simply to escape from frozen locks.
930
9312004-09-09  Tristan Savatier  <tristan at mpegtv.com>
932	* pthread.h (struct pthread_once_t_): Qualify the 'done' element
933	as 'volatile'.
934	* pthread_once.c: Concerned about possible race condition,
935	specifically on MPU systems re concurrent access to multibyte types.
936	[Maintainer's note: the race condition is harmless on SPU systems
937	and only a problem on MPU systems if concurrent access results in an
938	exception (presumably generated by a hardware interrupt). There are
939	other instances of similar harmless race conditions that have not
940	been identified as issues.]
941
9422004-09-09  Ross Johnson  <rpj at callisto.canberra.edu.au>
943
944	* pthread.h: Declare additional types as volatile.
945
9462004-08-27  Ross Johnson  <rpj at callisto.canberra.edu.au>
947
948	* pthread_barrier_wait.c (pthread_barrier_wait): Remove excessive code
949	by substituting the internal non-cancelable version of sem_wait
950	(ptw32_semwait).
951
9522004-08-25  Ross Johnson  <rpj at callisto.canberra.edu.au>
953
954	* pthread_join.c (pthread_join): Rewrite and re-order the conditional
955	tests in an attempt to improve efficiency and remove a race
956	condition.
957
9582004-08-23  Ross Johnson  <rpj at callisto.canberra.edu.au>
959
960	* create.c (pthread_create): Don't create a thread if the thread
961	id pointer location (first arg) is inaccessible. A memory
962	protection fault will result if the thread id arg isn't an accessible
963	location. This is consistent with GNU/Linux but different to
964	Solaris or MKS (and possibly others), which accept NULL as meaning
965	'don't return the created thread's ID'. Applications that run
966	using pthreads-win32 will run on all other POSIX threads
967	implementations, at least w.r.t. this feature.
968
969	It was decided not to copy the Solaris et al behaviour because,
970	although it would have simplified some application porting (but only
971	from Solaris to Windows), the feature is not technically necessary,
972	and the alternative segfault behaviour helps avoid buggy application
973	code.
974
9752004-07-01  Anuj Goyal  <anuj.goyal at gmail.com>
976
977	* builddmc.bat: New; Windows bat file to build the library.
978	* config.h (__DMC__): Support for Digital Mars compiler.
979	* create.c (__DMC__): Likewise.
980	* pthread_exit.c (__DMC__): Likewise.
981	* pthread_join.c (__DMC__): Likewise.
982	* ptw32_threadDestroy.c (__DMC__): Likewise.
983	* ptw32_threadStart.c (__DMC__): Likewise.
984	* ptw32_throw.c (__DMC__): Likewise.
985
9862004-06-29  Anuj Goyal  <anuj.goyal at gmail.com>
987
988	* pthread.h (__DMC__): Initial support for Digital Mars compiler.
989
9902004-06-29  Will Bryant  <will.bryant at ecosm.com>
991
992	* README.Borland: New; description of Borland changes.
993	* Bmakefile: New makefile for the Borland make utility.
994	* ptw32_InterlockedCompareExchange.c:
995	Add Borland compatible asm code.
996
9972004-06-26  Jason Bard  <BardJA at Npt.NUWC.Navy.Mil>
998
999	* pthread.h (HAVE_STRUCT_TIMESPEC): If undefined, define it
1000	to avoid timespec struct redefined errors elsewhere in an
1001	application.
1002
10032004-06-21  Ross Johnson  <rpj at callisto.canberra.edu.au>
1004
1005	* pthread.h (PTHREAD_RECURSIVE_MUTEX_INITIALIZER): Mutex
1006	initialiser added for compatibility with Linux threads and
1007	others; currently not included in SUSV3.
1008	* pthread.h (PTHREAD_ERRORCHECK_MUTEX_INITIALIZER): Likewise.
1009	* pthread.h (PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP): Likewise.
1010	* pthread.h (PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP): Likewise.
1011
1012	* ptw32_mutex_check_need_init.c (ptw32_mutex_check_need_init):
1013	Add new initialisers.
1014
1015	* pthread_mutex_lock.c (pthread_mutex_lock): Check for new
1016	initialisers.
1017	* pthread_mutex_trylock.c (pthread_mutex_trylock): Likewise.
1018	* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise.
1019	* pthread_mutex_unlock.c (pthread_mutex_unlock): Likewise.
1020	* pthread_mutex_destroy.c (pthread_mutex_destroy): Likewise.
1021
10222004-05-20  Ross Johnson  <rpj at callisto.canberra.edu.au>
1023
1024	* README.NONPORTABLE: Document pthread_win32_test_features_np().
1025	* FAQ: Update various answers.
1026
10272004-05-19  Ross Johnson  <rpj at callisto.canberra.edu.au>
1028
1029	* Makefile: Don't define _WIN32_WINNT on compiler command line.
1030	* GNUmakefile: Likewise.
1031
10322004-05-16  Ross Johnson  <rpj at callisto.canberra.edu.au>
1033
1034	* pthread_cancel.c (pthread_cancel): Adapted to use auto-detected
1035	QueueUserAPCEx features at run-time.
1036	(ptw32_RegisterCancelation): Drop in replacement for QueueUserAPCEx()
1037	if it can't be used. Provides older style non-preemptive async
1038	cancelation.
1039	* pthread_win32_attach_detach_np.c (pthread_win32_attach_np):
1040	Auto-detect quserex.dll and the availability of alertdrv.sys;
1041	initialise and close on process attach/detach.
1042	* global.c (ptw32_register_cancelation): Pointer to either
1043	QueueUserAPCEx() or ptw32_RegisterCancelation() depending on
1044	availability. QueueUserAPCEx makes pre-emptive async cancelation
1045	possible.
1046	* implement.h: Add definitions and prototypes related to QueueUserAPC.
1047
10482004-05-16  Panagiotis E. Hadjidoukas <peh at hpclab.ceid.upatras.gr>
1049
1050	* QueueUserAPCEx (separate contributed package): Provides preemptive
1051	APC feature.
1052	* pthread_cancel.c (pthread_cancel): Initial integration of
1053	QueueUserAPCEx into pthreads-win32 to provide true pre-emptive
1054	async cancelation of threads, including blocked threads.
1055
10562004-05-06  Makoto Kato  <raven at oldskool.jp>
1057
1058	* pthread.h (DWORD_PTR): Define typedef for older MSVC.
1059	* pthread_cancel.c (AMD64): Add architecture specific Context register.
1060	* ptw32_getprocessors.c: Use correct types (DWORD_PTR) for mask
1061	variables.
1062
10632004-04-06  P. van Bruggen  <pietvb at newbridges.nl>
1064
1065	* ptw32_threadDestroy.c: Destroy threadLock mutex to
1066	close a memory leak.
1067
10682004-02-13  Gustav Hallberg  <gustav at virtutech.com>
1069
1070	* pthread_equal.c: Remove redundant equality logic.
1071
10722003-12-10  Philippe Di Cristo  <philipped at voicebox.com>
1073
1074	* sem_timedwait.c (sem_timedwait): Fix timeout calculations.
1075
10762003-10-20  Alexander Terekhov  <TEREKHOV at de.ibm.com>
1077
1078	* pthread_mutex_timedlock.c (ptw32_semwait): Move to individual module.
1079	* ptw32_semwait.c: New module.
1080	* pthread_cond_wait.c (ptw32_cond_wait_cleanup): Replace cancelable
1081	sem_wait() call with non-cancelable ptw32_semwait() call.
1082	* pthread.c (private.c): Re-order for inlining. GNU C warned that
1083	function ptw32_semwait() was defined 'inline' after it was called.
1084	* pthread_cond_signal.c (ptw32_cond_unblock): Likewise.
1085	* pthread_delay_np.c: Disable Watcom warning with comment.
1086	* *.c (process.h): Remove include from .c files. This is conditionally
1087	included by the common project include files.
1088
10892003-10-20  James Ewing  <james.ewing at sveasoft.com>
1090
1091	* ptw32_getprocessors.c: Some Win32 environments don't have
1092	GetProcessAffinityMask(), so always return CPU count = 1 for them.
1093	* config.h (NEED_PROCESSOR_AFFINITY_MASK): Define for WinCE.
1094
10952003-10-15  Ross Johnson  <ross at callisto.canberra.edu.au>
1096
1097	* Re-indented all .c files using default GNU style to remove assorted
1098	editor ugliness (used GNU indent utility in default style).
1099
11002003-10-15  Alex Blanco  <Alex.Blanco at motorola.com>
1101
1102	* sem_init.c (sem_init): Would call CreateSemaphore even if the sema
1103	struct calloc failed; was not freeing calloced memory if either
1104	CreateSemaphore or CreateEvent failed.
1105
11062003-10-14  Ross Johnson  <ross at callisto.canberra.edu.au>
1107
1108	* pthread.h: Add Watcom compiler compatibility. Esssentially just add
1109	the cdecl attribute to all exposed function prototypes so that Watcom
1110	generates function call code compatible with non-Watcom built libraries.
1111	By default, Watcom uses registers to pass function args if possible rather
1112	than pushing to stack.
1113	* semaphore.h: Likewise.
1114	* sched.h: Likewise.
1115	* pthread_cond_wait.c (ptw32_cond_wait_cleanup): Define with cdecl attribute
1116	for Watcom compatibility. This routine is called via pthread_cleanup_push so
1117	it had to match function arg definition.
1118	* Wmakefile: New makefile for Watcom builds.
1119
11202003-09-14  Ross Johnson  <rpj at callisto.canberra.edu.au>
1121
1122	* pthread_setschedparam.c (pthread_setschedparam): Attempt to map
1123	all priority levels between max and min (as returned by
1124	sched_get_priority_min/max) to reasonable Win32 priority levels - i.e.
1125	levels between THREAD_PRIORITY_LOWEST/IDLE to THREAD_PRIORITY_LOWEST and
1126	between THREAD_PRIORITY_HIGHEST/TIME_CRITICAL to THREAD_PRIORITY_HIGHEST
1127	while others remain unchanged; record specified thread priority level
1128	for return by pthread_getschedparam.
1129
1130	Note that, previously, specified levels not matching Win32 priority levels
1131	would silently leave the current thread priority unaltered.
1132
1133	* pthread_getschedparam.c (pthread_getschedparam): Return the priority
1134	level specified by the latest pthread_setschedparam or pthread_create rather
1135	than the actual running thread priority as returned by GetThreadPriority - as
1136	required by POSIX. I.e. temporary or adjusted actual priority levels are not
1137	returned by this routine.
1138
1139	* pthread_create.c (pthread_create): For priority levels specified via
1140	pthread attributes, attempt to map all priority levels between max and
1141	min (as returned by sched_get_priority_min/max) to reasonable Win32
1142	priority levels; record priority level given via attributes, or
1143	inherited from parent thread, for later return by pthread_getschedparam.
1144
1145	* ptw32_new.c (ptw32_new): Initialise pthread_t_ sched_priority element.
1146
1147	* pthread_self.c (pthread_self): Set newly created implicit POSIX thread
1148	sched_priority to Win32 thread's current actual priority. Temporarily
1149	altered priorities can't be avoided in this case.
1150
1151	* implement.h (struct pthread_t_): Add new sched_priority element.
1152
11532003-09-12  Ross Johnson  <rpj at callisto.canberra.edu.au>
1154
1155	* sched_get_priority_min.c (sched_get_priority_min): On error should return -1
1156	with errno set.
1157	* sched_get_priority_max.c (sched_get_priority_max): Likewise.
1158
11592003-09-03  Ross Johnson  <rpj at callisto.canberra.edu.au>
1160
1161	* w32_cancelableWait.c (ptw32_cancelable_wait): Allow cancelation
1162	of implicit POSIX threads as well.
1163
11642003-09-02  Ross Johnson  <rpj at callisto.canberra.edu.au>
1165
1166	* pthread_win32_attach_detach_np.c (pthread_win32_thread_detach_np):
1167	Add comment.
1168
1169	* pthread_exit.c (pthread_exit): Fix to recycle the POSIX thread handle in
1170	addition to calling user TSD destructors. Move the implicit POSIX thread exit
1171	handling to ptw32_throw to centralise the logic.
1172
1173	* ptw32_throw.c (ptw32_throw): Implicit POSIX threads have no point
1174	to jump or throw to, so cleanup and exit the thread here in this case. For
1175	processes using the C runtime, the exit code will be set to the POSIX
1176	reason for the throw (i.e. PTHREAD_CANCEL or the value given to pthread_exit).
1177	Note that pthread_exit() already had similar logic, which has been moved to
1178	here.
1179
1180	* ptw32_threadDestroy.c (ptw32_threadDestroy): Don't close the Win32 handle
1181	of implicit POSIX threads - expect this to be done by Win32?
1182
11832003-09-01  Ross Johnson  <rpj at callisto.canberra.edu.au>
1184
1185	* pthread_self.c (pthread_self): The newly aquired pthread_t must be
1186	assigned to the reuse stack, not freed, if the routine fails somehow.
1187
11882003-08-13  Ross Johnson  <rpj at ise.canberra.edu.au>
1189
1190	* pthread_getschedparam.c (pthread_getschedparam): An invalid thread ID
1191	parameter was returning an incorrect error value; now uses a more exhaustive
1192	check for validity.
1193
1194	* pthread_setschedparam.c (pthread_setschedparam): Likewise.
1195
1196	* pthread_join.c (pthread_join): Now uses a more exhaustive
1197	check for validity.
1198
1199	* pthread_detach.c (pthread_detach): Likewise.
1200
1201	* pthread_cancel.c (pthread_cancel): Likewise.
1202
1203	* ptw32_threadDestroy.c (ptw32_threadDestroy): pthread_t structs are
1204	never freed - push them onto a stack for reuse.
1205
1206	* ptw32_new.c (ptw32_new): Check for reusable pthread_t before dynamically
1207	allocating new memory for the struct.
1208
1209	* pthread_kill.c (pthread_kill): New file; new routine; takes only a zero
1210	signal arg so that applications can check the thread arg for validity; checks
1211	that the underlying Win32 thread HANDLE is valid.
1212
1213	* pthread.h (pthread_kill): Add prototype.
1214
1215	* ptw32_reuse.c (ptw32_threadReusePop): New file; new routine; pop a
1216	pthread_t off the reuse stack. pthread_t_ structs that have been destroyed, i.e.
1217	have exited detached or have been joined, are cleaned up and put onto a reuse
1218	stack. Consequently, thread IDs are no longer freed once calloced. The library
1219	will attempt to get a struct off this stack before asking the system to alloc
1220	new memory when creating threads. The stack is guarded by a global mutex.
1221	(ptw32_threadReusePush): New routine; push a pthread_t onto the reuse stack.
1222
1223	* implement.h (ptw32_threadReusePush): Add new prototype.
1224	(ptw32_threadReusePop): Likewise.
1225	(pthread_t): Add new element.
1226
1227	* ptw32_processTerminate.c (ptw32_processTerminate): Delete the thread
1228	reuse lock; free all thread ID structs on the thread reuse stack.
1229
1230	* ptw32_processInitialize.c (ptw32_processInitialize): Initialise the
1231	thread reuse lock.
1232
12332003-07-19  Ross Johnson  <rpj at ise.canberra.edu.au>
1234
1235	* GNUmakefile: modified to work under MsysDTK environment.
1236	* pthread_spin_lock.c (pthread_spin_lock): Check for NULL arg.
1237	* pthread_spin_unlock.c (pthread_spin_unlock): Likewise.
1238	* pthread_spin_trylock.c (pthread_spin_trylock): Likewise;
1239	fix incorrect pointer value if lock is dynamically initialised by
1240	this function.
1241	* sem_init.c (sem_init): Initialise sem_t value to quell compiler warning.
1242	* sem_destroy.c (sem_destroy): Likewise.
1243	* ptw32_threadStart.c (non-MSVC code sections): Include <exception> rather
1244	than old-style <new.h>; fix all std:: namespace entities such as
1245	std::terminate_handler instances and associated methods.
1246	* ptw32_callUserDestroyRoutines.c (non-MSVC code sections): Likewise.
1247
12482003-06-24  Piet van Bruggen  <pietvb at newbridges.nl>
1249
1250	* pthread_spin_destroy.c (pthread_spin_destroy): Was not freeing the
1251	spinlock struct.
1252
12532003-06-22  Nicolas Barry  <boozai at yahoo.com>
1254
1255	* pthread_mutex_destroy.c (pthread_mutex_destroy): When called
1256	with a recursive mutex that was locked by the current thread, the
1257	function was failing with a success return code.
1258
12592003-05-15  Steven Reddie  <Steven.Reddie at ca.com>
1260
1261	* pthread_win32_attach_detach_np.c (pthread_win32_process_detach_np):
1262	NULLify ptw32_selfThreadKey after the thread is destroyed, otherwise
1263	destructors calling pthreads routines might resurrect it again, creating
1264	memory leaks. Call the underlying Win32 Tls routine directly rather than
1265	pthread_setspecific().
1266	(pthread_win32_thread_detach_np): Likewise.
1267
12682003-05-14  Viv  <vcotirlea at hotmail.com>
1269
1270	* pthread.dsp: Change /MT compile flag to /MD.
1271
12722003-03-04  Alexander Terekhov  <TEREKHOV at de.ibm.com>
1273
1274	* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Fix failure to
1275	set ownership of mutex on second grab after abstime timeout.
1276	- bug reported by Robert Strycek <strycek at posam.sk>
1277
12782002-12-17  Thomas Pfaff  <tpfaff at gmx.net>
1279
1280	* pthread_mutex_lock.c (ptw32_semwait): New static routine to provide
1281	a non-cancelable sem_wait() function. This is consistent with the
1282	way that pthread_mutex_timedlock.c does it.
1283	(pthread_mutex_lock): Use ptw32_semwait() instead of sem_wait().
1284
12852002-12-11  Thomas Pfaff  <tpfaff at gmx.net>
1286
1287	* pthread_mutex_trylock.c: Should return EBUSY rather than EDEADLK.
1288	* pthread_mutex_destroy.c: Remove redundant ownership test (the
1289	trylock call does this for us); do not destroy a recursively locked
1290	mutex.
1291
12922002-09-20  Michael Johnson  <michaelj at maine.rr.com>
1293
1294	* pthread_cond_destroy.c (pthread_cond_destroy):
1295	When two different threads exist, and one is attempting to
1296	destroy a condition variable while the other is attempting to
1297	initialize a condition variable that was created with
1298	PTHREAD_COND_INITIALIZER, a deadlock can occur. Shrink
1299	the ptw32_cond_list_lock critical section to fix it.
1300
13012002-07-31  Ross Johnson  <rpj at special.ise.canberra.edu.au>
1302
1303	* ptw32_threadStart.c (ptw32_threadStart): Thread cancelLock
1304	destruction moved to ptw32_threadDestroy().
1305
1306	* ptw32_threadDestroy.c (ptw32_threadDestroy):  Destroy
1307	the thread's cancelLock. Moved here from ptw32_threadStart.c
1308	to cleanup implicit threads as well.
1309
13102002-07-30  Alexander Terekhov  <TEREKHOV at de.ibm.com>
1311
1312	* pthread_cond_wait.c (ptw32_cond_wait_cleanup):
1313	Remove code designed to avoid/prevent spurious wakeup
1314	problems. It is believed that the sem_timedwait() call
1315	is consuming a CV signal that it shouldn't and this is
1316	breaking the avoidance logic.
1317
13182002-07-30  Ross Johnson  <rpj at ise.canberra.edu.au>
1319
1320	* sem_timedwait.c (sem_timedwait): Tighten checks for
1321	unreasonable abstime values - that would result in
1322	unexpected timeout values.
1323
1324	* w32_CancelableWait.c (ptw32_cancelable_wait):
1325	Tighten up return value checking and add comments.
1326
1327
13282002-06-08  Ross Johnson  <rpj at special.ise.canberra.edu.au>
1329
1330	* sem_getvalue.c (sem_getvalue): Now returns a value for the
1331	NEED_SEM version (i.e. earlier versions of WinCE).
1332
1333
13342002-06-04  Rob Fanner  <rfanner at stonethree.com>
1335
1336	* sem_getvalue.c (sem_getvalue): The Johnson M. Hart
1337	approach didn't work - we are forced to take an
1338	intrusive approach. We try to decrement the sema
1339	and then immediately release it again to get the
1340	value. There is a small probability that this may
1341	block other threads, but only momentarily.
1342
13432002-06-03  Ross Johnson  <rpj at ise.canberra.edu.au>
1344
1345	* sem_init.c (sem_init): Initialise Win32 semaphores
1346	to _POSIX_SEM_VALUE_MAX (which this implementation
1347	defines in pthread.h) so that sem_getvalue() can use
1348	the trick described in the comments in sem_getvalue().
1349	* pthread.h (_POSIX_SEM_VALUE_MAX): Defined.
1350	(_POSIX_SEM_NSEMS_MAX): Defined - not used but may be
1351	useful for source code portability.
1352
13532002-06-03  Rob Fanner  <rfanner at stonethree.com>
1354
1355	* sem_getvalue.c (sem_getvalue): Did not work on NT.
1356	Use approach suggested by Johnson M. Hart in his book
1357	"Win32 System Programming".
1358
13592002-02-28  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1360
1361	* errno.c: Compiler directive was incorrectly including code.
1362	* pthread.h: Conditionally added some #defines from config.h
1363	needed when not building the library. e.g. NEED_ERRNO, NEED_SEM.
1364	(PTW32_DLLPORT): Now only defined if _DLL defined.
1365	(_errno): Compiler directive was incorrectly including prototype.
1366	* sched.h: Conditionally added some #defines from config.h
1367	needed when not building the library.
1368	* semaphore.h: Replace an instance of NEED_SEM that should
1369	have been NEED_ERRNO. This change currently has nil effect.
1370
1371	* GNUmakefile: Correct some recent changes.
1372
1373	* Makefile: Add rule to generate pre-processor output.
1374
13752002-02-23  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1376
1377	* pthread_rwlock_timedrdlock.c: New - untested.
1378	* pthread_rwlock_timedwrlock.c: New - untested.
1379
1380	* Testsuite passed (except known MSVC++ problems)
1381
1382	* pthread_cond_destroy.c: Expand the time change
1383	critical section to solve deadlock problem.
1384
1385	* pthread.c: Add all remaining C modules.
1386	* pthread.h: Use dllexport/dllimport attributes on functions
1387	to avoid using pthread.def.
1388	* sched.h: Likewise.
1389	* semaphore.h: Likewise.
1390	* GNUmakefile: Add new targets for single translation
1391	unit build to maximise inlining potential; generate
1392	pthread.def automatically.
1393	* Makefile: Likewise, but no longer uses pthread.def.
1394
13952002-02-20  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1396
1397	* pthread_cond_destroy.c (pthread_cond_destroy):
1398	Enter the time change critical section earlier.
1399
14002002-02-17  Ross Johnson  <rpj at setup1.ise.canberra.edu.au
1401
1402	* Testsuite passed.
1403
1404	* pthread_timechange_handler_np.c: New; following
1405	a suggestion from Alexander Terekhov that CVs should
1406	be broadcast so that they all re-evaluate their
1407	condition variables and reset a new timeout if
1408	required, whenever an application receives a
1409	WM_TIMECHANGE message. This message indicates that
1410	the system time has been changed. Therefore, CVs
1411	waiting for a timeout set as an abs_time will possibly
1412	not wake up at the expected time. Some applications
1413	may not be tolerant of this.
1414	* pthread_cond_init.c: Add CV to linked list.
1415	* pthread_cond_destroy.c: Remove CV from linked list.
1416	* global.c (ptw32_cond_list_head): New variable.
1417	(ptw32_cond_list_tail): New variable.
1418	(ptw32_cond_list_cs): New critical section.
1419	* ptw32_processInitialize (ptw32_cond_list_cs): Initialize.
1420	* ptw32_processTerminate (ptw32_cond_list_cs): Delete.
1421
1422
1423	* Reduce executable size.
1424	  -----------------------
1425	When linking with the static library, only those
1426	routines actually called, either directly or indirectly
1427	should be included.
1428
1429	[Gcc has the -ffunction-segments option to do this but MSVC
1430	doesn't have this feature as far as I can determine. Other
1431	compilers are undetermined as well. - rpj]
1432
1433	* spin.c: Split file into function segments.
1434	* ptw32_spinlock_check_need_init.c: Separated routine from spin.c.
1435	* pthread_spin_init.c: Likewise.
1436	* pthread_spin_destroy.c: Likewise.
1437	* pthread_spin_lock.c: Likewise.
1438	* pthread_spin_unlock.c: Likewise.
1439	* pthread_spin_trylock.c: Likewise.
1440
1441	* sync.c: Split file into function segments.
1442	* pthread_detach.c: Separated routine from sync.c.
1443	* pthread_join.c: Likewise.
1444
1445	* tsd.c: Split file into function segments.
1446	* pthread_key_create.c: Separated routine from tsd.c.
1447	* pthread_key_delete.c: Likewise.
1448	* pthread_setspecific.c: Likewise.
1449	* pthread_getspecific.c: Likewise.
1450
1451	* sched.c: Split file into function segments.
1452	* pthread_attr_setschedpolicy.c: Separated routine from sched.c.
1453	* pthread_attr_getschedpolicy.c: Likewise.
1454	* pthread_attr_setschedparam.c: Likewise.
1455	* pthread_attr_getschedparam.c: Likewise.
1456	* pthread_attr_setinheritsched.c: Likewise.
1457	* pthread_attr_getinheritsched.c: Likewise.
1458	* pthread_setschedparam.c: Likewise.
1459	* pthread_getschedparam.c: Likewise.
1460	* sched_get_priority_max.c: Likewise.
1461	* sched_get_priority_min.c: Likewise.
1462	* sched_setscheduler.c: Likewise.
1463	* sched_getscheduler.c: Likewise.
1464	* sched_yield.c: Likewise.
1465
1466
14672002-02-16  Ross Johnson  <rpj at setup1.ise.canberra.edu.au
1468
1469	Reduce executable size.
1470	-----------------------
1471	When linking with the static library, only those
1472	routines actually called, either directly or indirectly
1473	should be included.
1474
1475	[Gcc has the -ffunction-segments option to do this but MSVC
1476	doesn't have this feature as far as I can determine. Other
1477	compilers are undetermined as well. - rpj]
1478
1479	* mutex.c: Split file into function segments.
1480	* pthread_mutexattr_destroy.c: Separated routine from mutex.c
1481	* pthread_mutexattr_getpshared.c: Likewise.
1482	* pthread_mutexattr_gettype.c: Likewise.
1483	* pthread_mutexattr_init.c: Likewise.
1484	* pthread_mutexattr_setpshared.c: Likewise.
1485	* pthread_mutexattr_settype.c: Likewise.
1486	* ptw32_mutex_check_need_init.c: Likewise.
1487	* pthread_mutex_destroy.c: Likewise.
1488	* pthread_mutex_init.c: Likewise.
1489	* pthread_mutex_lock.c: Likewise.
1490	* pthread_mutex_timedlock.c: Likewise.
1491	* pthread_mutex_trylock.c: Likewise.
1492	* pthread_mutex_unlock.c: Likewise.
1493
1494	* private.c: Split file into function segments.
1495	* ptw32_InterlockedCompareExchange.c: Separated routine from private.c
1496	* ptw32_callUserDestroyRoutines.c: Likewise.
1497	* ptw32_getprocessors.c: Likewise.
1498	* ptw32_processInitialize.c: Likewise.
1499	* ptw32_processTerminate.c: Likewise.
1500	* ptw32_threadDestroy.c: Likewise.
1501	* ptw32_threadStart.c: Likewise.
1502	* ptw32_throw.c: Likewise.
1503	* ptw32_timespec.c: Likewise.
1504	* ptw32_tkAssocCreate.c: Likewise.
1505	* ptw32_tkAssocDestroy.c: Likewise.
1506
1507	* rwlock.c: Split file into function segments.
1508	* pthread_rwlockattr_destroy.c: Separated routine from rwlock.c
1509	* pthread_rwlockattr_getpshared.c: Likewise.
1510	* pthread_rwlockattr_init.c: Likewise.
1511	* pthread_rwlockattr_setpshared.c: Likewise.
1512	* ptw32_rwlock_check_need_init.c: Likewise.
1513	* pthread_rwlock_destroy.c: Likewise.
1514	* pthread_rwlock_init.c: Likewise.
1515	* pthread_rwlock_rdlock.c: Likewise.
1516	* pthread_rwlock_tryrdlock.c: Likewise.
1517	* pthread_rwlock_trywrlock.c: Likewise.
1518	* pthread_rwlock_unlock.c: Likewise.
1519	* pthread_rwlock_wrlock.c: Likewise.
1520
15212002-02-10  Ross Johnson  <rpj at setup1.ise.canberra.edu.au
1522
1523	Reduce executable size.
1524	-----------------------
1525	When linking with the static library, only those
1526	routines actually called, either directly or indirectly
1527	should be included.
1528
1529	[Gcc has the -ffunction-segments option to do this but MSVC
1530	doesn't have this feature as far as I can determine. Other
1531	compilers are undetermined as well. - rpj]
1532
1533	* nonportable.c: Split file into function segments.
1534	* np_delay.c: Separated routine from nonportable.c
1535	* np_getw32threadhandle.c: Likewise.
1536	* np_mutexattr_setkind.c: Likewise.
1537	* np_mutexattr_getkind.c: Likewise.
1538	* np_num_processors.c: Likewise.
1539	* np_win32_attach_detach.c: Likewise.
1540
1541	* misc.c: Split file into function segments.
1542	* pthread_equal.c: Separated routine from nonportable.c.
1543	* pthread_getconcurrency.c: Likewise.
1544	* pthread_once.c: Likewise.
1545	* pthread_self.c: Likewise.
1546	* pthread_setconcurrency.c: Likewise.
1547	* ptw32_calloc.c: Likewise.
1548	* ptw32_new.c: Likewise.
1549	* w32_CancelableWait.c: Likewise.
1550
15512002-02-09  Ross Johnson  <rpj at setup1.ise.canberra.edu.au
1552
1553	Reduce executable size.
1554	-----------------------
1555	When linking with the static library, only those
1556	routines actually called, either directly or indirectly
1557	should be included.
1558
1559	[Gcc has the -ffunction-segments option to do this but MSVC
1560	doesn't have this feature as far as I can determine. Other
1561	compilers are undetermined as well. - rpj]
1562
1563	* condvar.c: Split file into function segments.
1564	* pthread_condattr_destroy.c: Separated routine from condvar.c.
1565	* pthread_condattr_getpshared.c: Likewise.
1566	* pthread_condattr_init.c: Likewise.
1567	* pthread_condattr_setpshared.c: Likewise.
1568	* ptw32_cond_check_need_init.c: Likewise.
1569	* pthread_cond_destroy.c: Likewise.
1570	* pthread_cond_init.c: Likewise.
1571	* pthread_cond_signal.c: Likewise.
1572	* pthread_cond_wait.c: Likewise.
1573
15742002-02-07  Alexander Terekhov<TEREKHOV at de.ibm.com>
1575
1576	* nonportable.c (pthread_delay_np): Make a true
1577	cancelation point. Deferred cancels will interrupt the
1578	wait.
1579
15802002-02-07  Ross Johnson  <rpj at setup1.ise.canberra.edu.au
1581
1582	* misc.c (ptw32_new): Add creation of cancelEvent so that
1583	implicit POSIX threads (Win32 threads with a POSIX face)
1584	are cancelable; mainly so that pthread_delay_np doesn't fail
1585	if called from the main thread.
1586	* create.c (pthread_create): Remove creation of cancelEvent
1587	from here; now in ptw32_new().
1588
1589	Reduce executable size.
1590	-----------------------
1591	When linking with the static library, only those
1592	routines actually called, either directly or indirectly
1593	should be included.
1594
1595	[Gcc has the -ffunction-segments option to do this but MSVC
1596	doesn't have this feature as far as I can determine. Other
1597	compilers are undetermined as well. - rpj]
1598
1599	* barrier.c: All routines are now in separate compilation units;
1600	This file is used to congregate the separate modules for
1601	potential inline optimisation and backward build compatibility.
1602	* cancel.c: Likewise.
1603	* pthread_barrierattr_destroy.c: Separated routine from cancel.c.
1604	* pthread_barrierattr_getpshared.c: Likewise.
1605	* pthread_barrierattr_init.c: Likewise.
1606	* pthread_barrierattr_setpshared.c: Likewise.
1607	* pthread_barrier_destroy.c: Likewise.
1608	* pthread_barrier_init.c: Likewise.
1609	* pthread_barrier_wait.c: Likewise.
1610	* pthread_cancel.c: Likewise.
1611	* pthread_setcancelstate.c: Likewise.
1612	* pthread_setcanceltype.c: Likewise.
1613	* pthread_testcancel.c: Likewise.
1614
16152002-02-04  Max Woodbury <mtew at cds.duke.edu>
1616
1617	Reduced name space pollution.
1618	-----------------------------
1619	When the appropriate symbols are defined, the headers
1620	will restrict the definitions of new names. In particular,
1621	it must be possible to NOT include the <windows.h>
1622	header and related definitions with some combination
1623	of symbol definitions. Secondly, it should be possible
1624	that additional definitions should be limited to POSIX
1625	compliant symbols by the definition of appropriate symbols.
1626
1627	* pthread.h: POSIX conditionals.
1628	* sched.h: POSIX conditionals.
1629	* semaphore.h: POSIX conditionals.
1630
1631	* semaphore.c: Included <limits.h>.
1632	(sem_init): Changed magic 0x7FFFFFFFL to INT_MAX.
1633	(sem_getvalue): Trial version.
1634
1635	Reduce executable size.
1636	-----------------------
1637	When linking with the static library, only those
1638	routines actually called, either directly or indirectly
1639	should be included.
1640
1641	[Gcc has the -ffunction-segments option to do this but MSVC
1642	doesn't have this feature as far as I can determine. Other
1643	compilers are undetermined as well. - rpj]
1644
1645	* semaphore.c: All routines are now in separate compilation units;
1646	This file is used to congregate the separate modules for
1647	potential inline optimisation and backward build compatibility.
1648	* sem_close.c: Separated routine from semaphore.c.
1649	* ptw32_decrease_semaphore.c: Likewise.
1650	* sem_destroy.c: Likewise.
1651	* sem_getvalue.c: Likewise.
1652	* ptw32_increase_semaphore.c: Likewise.
1653	* sem_init.c: Likewise.
1654	* sem_open.c: Likewise.
1655	* sem_post.c: Likewise.
1656	* sem_post_multiple.c: Likewise.
1657	* sem_timedwait.c: Likewise.
1658	* sem_trywait.c: Likewise.
1659	* sem_unlink.c: Likewise.
1660	* sem_wait.c: Likewise.
1661
16622002-02-04  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1663
1664	The following extends the idea above to the rest of pthreads-win32 - rpj
1665
1666	* attr.c: All routines are now in separate compilation units;
1667	This file is used to congregate the separate modules for
1668	potential inline optimisation and backward build compatibility.
1669	* pthread_attr_destroy.c: Separated routine from attr.c.
1670	* pthread_attr_getdetachstate.c: Likewise.
1671	* pthread_attr_getscope.c: Likewise.
1672	* pthread_attr_getstackaddr.c: Likewise.
1673	* pthread_attr_getstacksize.c: Likewise.
1674	* pthread_attr_init.c: Likewise.
1675	* pthread_attr_is_attr.c: Likewise.
1676	* pthread_attr_setdetachstate.c: Likewise.
1677	* pthread_attr_setscope.c: Likewise.
1678	* pthread_attr_setstackaddr.c: Likewise.
1679	* pthread_attr_setstacksize.c: Likewise.
1680
1681	* pthread.c: Agregation of agregate modules for super-inlineability.
1682
16832002-02-02  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1684
1685	* cancel.c: Rearranged some code and introduced checks
1686	to disable cancelation at the start of a thread's cancelation
1687	run to prevent double cancelation. The main problem
1688	arises if a thread is canceling and then receives a subsequent
1689	async cancel request.
1690	* private.c: Likewise.
1691	* condvar.c: Place pragmas around cleanup_push/pop to turn
1692	off inline optimisation (/Obn where n>0 - MSVC only). Various
1693	optimisation switches in MSVC turn this on, which interferes with
1694	the way that cleanup handlers are run in C++ EH and SEH
1695	code. Application code compiled with inline optimisation must
1696	also wrap cleanup_push/pop blocks with the pragmas, e.g.
1697	  #pragma inline_depth(0)
1698	  pthread_cleanup_push(...)
1699	    ...
1700	  pthread_cleanup_pop(...)
1701	  #pragma inline_depth(8)
1702	* rwlock.c: Likewise.
1703	* mutex.c: Remove attempts to inline some functions.
1704	* signal.c: Modify misleading comment.
1705
17062002-02-01  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1707
1708	* semaphore.c (sem_trywait): Fix missing errno return
1709	for systems that define NEED_SEM (e.g. early WinCE).
1710	* mutex.c (pthread_mutex_timedlock): Return ENOTSUP
1711	for systems that define NEED_SEM since they don't
1712	have sem_trywait().
1713
17142002-01-27  Ross Johnson  <rpj at special.ise.canberra.edu.au>
1715
1716	* mutex.c (pthread_mutex_timedlock): New function suggested by
1717	Alexander Terekhov. The logic required to implement this
1718	properly came from Alexander, with some collaboration
1719	with Thomas Pfaff.
1720	(pthread_mutex_unlock): Wrap the waiters check and sema
1721	post in a critical section to prevent a race with
1722	pthread_mutex_timedlock.
1723	(ptw32_timed_semwait): New function;
1724	returns a special result if the absolute timeout parameter
1725	represents a time already passed when called; used by
1726	pthread_mutex_timedwait(). Have deliberately not reused
1727	the name "ptw32_sem_timedwait" because they are not the same
1728	routine.
1729	* condvar.c (ptw32_cond_timedwait): Use the new sem_timedwait()
1730	instead of ptw32_sem_timedwait(), which now has a different
1731	function. See previous.
1732	* implement.h: Remove prototype for ptw32_sem_timedwait.
1733	See next.
1734	(pthread_mutex_t_): Add critical section element for access
1735	to lock_idx during mutex post-timeout processing.
1736	* semaphore.h (sem_timedwait): See next.
1737	* semaphore.c (sem_timedwait): See next.
1738	* private.c (ptw32_sem_timedwait): Move to semaphore.c
1739	and rename as sem_timedwait().
1740
17412002-01-18  Ross Johnson  <rpj at special.ise.canberra.edu.au>
1742
1743	* sync.c (pthread_join): Was getting the exit code from the
1744	calling thread rather than the joined thread if
1745	defined(__MINGW32__) && !defined(__MSVCRT__).
1746
17472002-01-15  Ross Johnson  <rpj at special.ise.canberra.edu.au>
1748
1749	* pthread.h: Unless the build explicitly defines __CLEANUP_SEH,
1750	__CLEANUP_CXX, or __CLEANUP_C, then the build defaults to
1751	__CLEANUP_C style cleanup. This style uses setjmp/longjmp
1752	in the cancelation and thread exit implementations and therefore
1753	won't do stack unwinding if linked to applications that have it
1754	(e.g. C++ apps). This is currently consistent with most/all
1755	commercial Unix POSIX threads implementations.
1756
1757	* spin.c (pthread_spin_init): Edit renamed function call.
1758	* nonportable.c (pthread_num_processors_np): New.
1759	(pthread_getprocessors_np): Renamed to ptw32_getprocessors
1760	and moved to private.c.
1761	* private.c (pthread_getprocessors): Moved here from
1762	nonportable.c.
1763	* pthread.def (pthread_getprocessors_np): Removed
1764	from export list.
1765
1766	* rwlock.c (pthread_rwlockattr_init): New.
1767	(pthread_rwlockattr_destroy): New.
1768	(pthread_rwlockattr_getpshared): New.
1769	(pthread_rwlockattr_setpshared): New.
1770
17712002-01-14  Ross Johnson  <rpj at special.ise.canberra.edu.au>
1772
1773	* attr.c (pthread_attr_setscope): Fix struct pointer
1774	indirection error introduced 2002-01-04.
1775	(pthread_attr_getscope): Likewise.
1776
17772002-01-12  Ross Johnson  <rpj at special.ise.canberra.edu.au>
1778
1779	* pthread.dsp (SOURCE): Add missing source files.
1780
17812002-01-08  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1782
1783	* mutex.c (pthread_mutex_trylock): use
1784	ptw32_interlocked_compare_exchange function pointer
1785	rather than ptw32_InterlockedCompareExchange() directly
1786	to retain portability to non-iX86 processors,
1787	e.g. WinCE etc. The pointer will point to the native
1788	OS version of InterlockedCompareExchange() if the
1789	OS supports it (see ChangeLog entry of 2001-10-17).
1790
17912002-01-07  Thomas Pfaff <tpfaff at gmx.net>, Alexander Terekhov <TEREKHOV at de.ibm.com>
1792
1793	* mutex.c (pthread_mutex_init): Remove critical
1794	section calls.
1795	(pthread_mutex_destroy): Likewise.
1796	(pthread_mutex_unlock): Likewise.
1797	(pthread_mutex_trylock): Likewise; uses
1798	ptw32_InterlockedCompareExchange() to avoid need for
1799	critical section; library is no longer i386 compatible;
1800	recursive mutexes now increment the lock count rather
1801	than return EBUSY; errorcheck mutexes return EDEADLCK
1802	rather than EBUSY. This behaviour is consistent with the
1803	Solaris pthreads implementation.
1804	* implement.h (pthread_mutex_t_): Remove critical
1805	section element - no longer needed.
1806
1807
18082002-01-04  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1809
1810	* attr.c (pthread_attr_setscope): Add more error
1811	checking and actually store the scope value even
1812	though it's not really necessary.
1813	(pthread_attr_getscope): Return stored value.
1814	* implement.h (pthread_attr_t_): Add new scope element.
1815	* ANNOUNCE: Fix out of date comment next to
1816	pthread_attr_setscope in conformance section.
1817
18182001-12-21  Alexander Terekhov <TEREKHOV at de.ibm.com>
1819
1820	* mutex.c (pthread_mutex_lock): Decrementing lock_idx was
1821	not thread-safe.
1822	(pthread_mutex_trylock): Likewise.
1823
18242001-10-26  prionx@juno.com
1825
1826	* semaphore.c (sem_init): Fix typo and missing bracket
1827	in conditionally compiled code. Only older versions of
1828	WinCE require this code, hence it doesn't normally get
1829	tested; somehow when sem_t reverted to an opaque struct
1830	the calloc NULL check was left in the conditionally included
1831	section.
1832	(sem_destroy): Likewise, the calloced sem_t wasn't being freed.
1833
18342001-10-25  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1835
1836	* GNUmakefile (libwsock32): Add to linker flags for
1837	WSAGetLastError() and WSASetLastError().
1838	* Makefile (wsock32.lib): Likewise.
1839	* create.c: Minor mostly inert changes.
1840	* implement.h (PTW32_MAX): Move into here and renamed
1841	from sched.h.
1842	(PTW32_MIN): Likewise.
1843	* GNUmakefile (TEST_ICE): Define if testing internal
1844	implementation of InterlockedCompareExchange.
1845	* Makefile (TEST_ICE): Likewise.
1846	* private.c (TEST_ICE): Likewise.
1847
18482001-10-24  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1849
1850	* attr.c (pthread_attr_setstacksize): Quell warning
1851	from LCC by conditionally compiling the stacksize
1852	validity check. LCC correctly warns that the condition
1853	(stacksize < PTHREAD_STACK_MIN) is suspicious
1854	because STACK_MIN is 0 and stacksize is of type
1855	size_t (or unsigned int).
1856
18572001-10-17  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1858
1859	* barrier.c: Move _LONG and _LPLONG defines into
1860	implement.h; rename to PTW32_INTERLOCKED_LONG and
1861	PTW32_INTERLOCKED_LPLONG respectively.
1862	* spin.c: Likewise; ptw32_interlocked_compare_exchange used
1863	in place of InterlockedCompareExchange directly.
1864	* global.c (ptw32_interlocked_compare_exchange): Add
1865	prototype for this new routine pointer to be used when
1866	InterlockedCompareExchange isn't supported by Windows.
1867	* nonportable.c (pthread_win32_process_attach_np): Check for
1868	support of InterlockedCompareExchange in kernel32 and assign its
1869	address to ptw32_interlocked_compare_exchange if it exists, or
1870	our own ix86 specific implementation ptw32_InterlockedCompareExchange.
1871	*private.c (ptw32_InterlockedCompareExchange): An
1872	implementation of InterlockedCompareExchange() which is
1873	specific to ix86; written directly in assembler for either
1874	MSVC or GNU C; needed because Windows 95 doesn't support
1875	InterlockedCompareExchange().
1876
1877	* sched.c (sched_get_priority_min): Extend to return
1878	THREAD_PRIORITY_IDLE.
1879	(sched_get_priority_max): Extend to return
1880	THREAD_PRIORITY_CRITICAL.
1881
18822001-10-15  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1883
1884	* spin.c (pthread_spin_lock): PTHREAD_SPINLOCK_INITIALIZER
1885	was causing a program fault.
1886	(pthread_spin_init): Could have alloced memory
1887	without freeing under some error conditions.
1888
1889	* mutex.c (pthread_mutex_init): Move memory
1890	allocation of mutex struct after checking for
1891	PROCESS_SHARED.
1892
18932001-10-12  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1894
1895	* spin.c (pthread_spin_unlock): Was not returning
1896	EPERM if the spinlock was not locked, for multi CPU
1897	machines.
1898
18992001-10-08  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1900
1901	* spin.c (pthread_spin_trylock): Was not returning
1902	EBUSY for multi CPU machines.
1903
19042001-08-24  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1905
1906	* condvar.c (pthread_cond_destroy): Remove cv element
1907	that is no longer used.
1908	* implement.h: Likewise.
1909
19102001-08-23  Alexander Terekhov <TEREKHOV at de.ibm.com>
1911
1912	* condvar.c (pthread_cond_destroy): fix bug with
1913	respect to deadlock in the case of concurrent
1914	_destroy/_unblock; a condition variable can be destroyed
1915	immediately after all the threads that are blocked on
1916	it are awakened.
1917
19182001-08-23  Phil Frisbie, Jr. <phil at hawksoft.com>
1919
1920	* tsd.c (pthread_getspecific): Preserve the last
1921	winsock error [from WSAGetLastError()].
1922
19232001-07-18  Scott McCaskill <scott at magruder.org>
1924
1925	* mutex.c (pthread_mutexattr_init): Return ENOMEM
1926	immediately and don't dereference the NULL pointer
1927	if calloc fails.
1928	(pthread_mutexattr_getpshared): Don't dereference
1929	a pointer that is possibly NULL.
1930	* barrier.c (pthread_barrierattr_init): Likewise
1931	(pthread_barrierattr_getpshared): Don't dereference
1932	a pointer that is possibly NULL.
1933	* condvar.c (pthread_condattr_getpshared): Don't dereference
1934	a pointer that is possibly NULL.
1935
19362001-07-15  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1937
1938	* rwlock.c (pthread_rwlock_wrlock): Is allowed to be
1939	a cancelation point; re-enable deferred cancelability
1940	around the CV call.
1941
19422001-07-10  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1943
1944	* barrier.c: Still more revamping. The exclusive access
1945	mutex isn't really needed so it has been removed and replaced
1946	by an InterlockedDecrement(). nSerial has been removed.
1947	iStep is now dual-purpose. The process shared attribute
1948	is now stored in the barrier struct.
1949	* implement.h (pthread_barrier_t_): Lost some/gained one
1950	elements.
1951	* private.c (ptw32_threadStart): Removed some comments.
1952
19532001-07-10  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1954
1955	* barrier.c: Revamped to fix the race condition. Two alternating
1956	semaphores are used instead of the PulseEvent. Also improved
1957	overall throughput by returning PTHREAD_BARRIER_SERIAL_THREAD
1958	to the first waking thread.
1959	* implement.h (pthread_barrier_t_): Revamped.
1960
19612001-07-09  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1962
1963	* barrier.c: Fix several bugs in all routines. Now passes
1964	tests/barrier5.c which is fairly rigorous. There is still
1965	a non-optimal work-around for a race condition between
1966	the barrier breeched event signal and event wait. Basically
1967	the last (signalling) thread to hit the barrier yields
1968	to allow any other threads, which may have lost the race,
1969	to complete.
1970
19712001-07-07  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1972
1973	* barrier.c: Changed synchronisation mechanism to a
1974	Win32 manual reset Event and use PulseEvent to signal
1975	waiting threads. If the implementation continued to use
1976	a semaphore it would require a second semaphore and
1977	some management to use them alternately as barriers. A
1978	single semaphore allows threads to cascade from one barrier
1979	through the next, leaving some threads blocked at the first.
1980	* implement.h (pthread_barrier_t_): As per above.
1981	* general: Made a number of other routines inlinable.
1982
19832001-07-07  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1984
1985	* spin.c: Revamped and working; included static initialiser.
1986	Now beta level.
1987	* barrier.c: Likewise.
1988	* condvar.c: Macro constant change; inline auto init routine.
1989	* mutex.c: Likewise.
1990	* rwlock.c: Likewise.
1991	* private.c: Add support for spinlock initialiser.
1992	* global.c: Likewise.
1993	* implement.h: Likewise.
1994	* pthread.h (PTHREAD_SPINLOCK_INITIALIZER): Fix typo.
1995
19962001-07-05  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
1997
1998	* barrier.c: Remove static initialisation - irrelevent
1999	for this object.
2000	* pthread.h (PTHREAD_BARRIER_INITIALIZER): Removed.
2001	* rwlock.c (pthread_rwlock_wrlock): This routine is
2002	not a cancelation point - disable deferred
2003	cancelation around call to pthread_cond_wait().
2004
20052001-07-05  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2006
2007	* spin.c: New module implementing spin locks.
2008	* barrier.c: New module implementing barriers.
2009	* pthread.h (_POSIX_SPIN_LOCKS): defined.
2010	(_POSIX_BARRIERS): Defined.
2011	(pthread_spin_*): Defined.
2012	(pthread_barrier*): Defined.
2013	(PTHREAD_BARRIER_SERIAL_THREAD): Defined.
2014	* implement.h (pthread_spinlock_t_): Defined.
2015	(pthread_barrier_t_): Defined.
2016	(pthread_barrierattr_t_): Defined.
2017
2018	* mutex.c (pthread_mutex_lock): Return with the error
2019	if an auto-initialiser initialisation fails.
2020
2021	* nonportable.c (pthread_getprocessors_np): New; gets the
2022	number of available processors for the current process.
2023
20242001-07-03  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2025
2026	* pthread.h (_POSIX_READER_WRITER_LOCKS): Define it
2027	if not already defined.
2028
20292001-07-01  Alexander Terekhov <TEREKHOV at de.ibm.com>
2030
2031	* condvar.c: Fixed lost signal bug reported by Timur Aydin
2032	(taydin@snet.net).
2033	[RPJ (me) didn't translate the original algorithm
2034	correctly.]
2035	* semaphore.c: Added sem_post_multiple; this is a useful
2036	routine, but it doesn't appear to be standard. For now it's
2037	not an exported function.
2038
20392001-06-25  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2040
2041	* create.c (pthread_create): Add priority inheritance
2042	attributes.
2043	* mutex.c (pthread_mutex_lock): Remove some overhead for
2044	PTHREAD_MUTEX_NORMAL mutex types. Specifically, avoid
2045	calling pthread_self() and pthread_equal() to check/set
2046	the mutex owner. Introduce a new pseudo owner for this
2047	type. Test results suggest increases in speed of up to
2048	90% for non-blocking locks.
2049	This is the default type of mutex used internally by other
2050	synchronising objects, ie. condition variables and
2051	read-write locks. The test rwlock7.c shows about a
2052	30-35% speed increase over snapshot 2001-06-06. The
2053	price of this is that the application developer
2054	must ensure correct behaviour, or explicitly set the
2055	mutex to a safer type such as PTHREAD_MUTEX_ERRORCHECK.
2056	For example, PTHREAD_MUTEX_NORMAL (or PTHREAD_MUTEX_DEFAULT)
2057	type mutexes will not return an error if a thread which is not
2058	the owner calls pthread_mutex_unlock. The call will succeed
2059	in unlocking the mutex if it is currently locked, but a
2060	subsequent unlock by the true owner will then fail with EPERM.
2061	This is however consistent with some other implementations.
2062	(pthread_mutex_unlock): Likewise.
2063	(pthread_mutex_trylock): Likewise.
2064	(pthread_mutex_destroy): Likewise.
2065	* attr.c (pthread_attr_init): PTHREAD_EXPLICIT_SCHED is the
2066	default inheritance attribute; THREAD_PRIORITY_NORMAL is
2067	the default priority for new threads.
2068	* sched.c (pthread_attr_setschedpolicy): Added routine.
2069	(pthread_attr_getschedpolicy): Added routine.
2070	(pthread_attr_setinheritsched): Added routine.
2071	(pthread_attr_getinheritsched): Added routine.
2072	* pthread.h (sched_rr_set_interval): Added as a macro;
2073	returns -1 with errno set to ENOSYS.
2074
20752001-06-23  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2076
2077	*sched.c (pthread_attr_setschedparam): Add priority range
2078	check.
2079	(sched_setscheduler): New function; checks for a valid
2080	pid and policy; checks for permission to set information
2081	in the target process; expects pid to be a Win32 process ID,
2082	not a process handle; the only scheduler policy allowed is
2083	SCHED_OTHER.
2084	(sched_getscheduler): Likewise, but checks for permission
2085	to query.
2086	* pthread.h (SCHED_*): Moved to sched.h as defined in the
2087	POSIX standard.
2088	* sched.h (SCHED_*): Moved from pthread.h.
2089	(pid_t): Defined if necessary.
2090	(sched_setscheduler): Defined.
2091	(sched_getscheduler): Defined.
2092	* pthread.def (sched_setscheduler): Exported.
2093	(sched_getscheduler): Likewise.
2094
20952001-06-23  Ralf Brese <Ralf.Brese at pdb4.siemens.de>
2096
2097	* create.c (pthread_create): Set thread priority from
2098	thread attributes.
2099
21002001-06-18  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2101
2102	* Made organisational-only changes to UWIN additions.
2103	* dll.c (dllMain): Moved UWIN process attach code
2104	to pthread_win32_process_attach_np(); moved
2105	instance of pthread_count to global.c.
2106	* global.c (pthread_count): Moved from dll.c.
2107	* nonportable.c (pthread_win32_process_attach_np):
2108	Moved _UWIN code to here from dll.c.
2109	* implement.h (pthread_count): Define extern int.
2110	* create.c (pthread_count): Remove extern int.
2111	* private.c (pthread_count): Likewise.
2112	* exit.c (pthread_count): Likewise.
2113
21142001-06-18  David Korn <dgk at research.att.com>
2115
2116	* dll.c: Added changes necessary to work with UWIN.
2117	* create.c: Likewise.
2118	* pthread.h: Likewise.
2119	* misc.c: Likewise.
2120	* exit.c: Likewise.
2121	* private.c: Likewise.
2122	* implement.h: Likewise.
2123	There is some room at the start of struct pthread_t_
2124	to implement the signal semantics in UWIN's posix.dll
2125	although this is not yet complete.
2126	* Nmakefile: Compatible with UWIN's Nmake utility.
2127	* Nmakefile.tests: Likewise - for running the tests.
2128
21292001-06-08  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2130
2131	* semaphore.h (sem_t): Fixed for compile and test.
2132	* implement.h (sem_t_): Likewise.
2133	* semaphore.c: Likewise.
2134	* private.c (ptw32_sem_timedwait): Updated to use new
2135	opaque sem_t.
2136
21372001-06-06  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2138
2139	* semaphore.h (sem_t): Is now an opaque pointer;
2140	moved actual definition to implement.h.
2141	* implement.h (sem_t_): Move here from semaphore.h;
2142	was the definition of sem_t.
2143	* semaphore.c: Wherever necessary, changed use of sem
2144	from that of a pointer to a pointer-pointer; added
2145	extra checks for a valid sem_t; NULL sem_t when
2146	it is destroyed; added extra checks when creating
2147	and destroying sem_t elements in the NEED_SEM
2148	code branches; changed from using a pthread_mutex_t
2149	((*sem)->mutex) to CRITICAL_SECTION ((*sem)->sem_lock_cs)
2150	in NEED_SEM branches for access serialisation.
2151
21522001-06-06  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2153
2154	* mutex.c (pthread_mutexattr_init): Remove
2155	ptw32_mutex_default_kind.
2156
21572001-06-05  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2158
2159	* nonportable.c (pthread_mutex_setdefaultkind_np):
2160	Remove - should not have been included in the first place.
2161	(pthread_mutex_getdefaultkind_np): Likewise.
2162	* global.c (ptw32_mutex_default_kind): Likewise.
2163	* mutex.c (pthread_mutex_init): Remove use of
2164	ptw32_mutex_default_kind.
2165	* pthread.h (pthread_mutex_setdefaultkind_np): Likewise.
2166	(pthread_mutex_getdefaultkind_np): Likewise.
2167	* pthread.def (pthread_mutexattr_setkind_np): Added.
2168	(pthread_mutexattr_getkind_np): Likewise.
2169
2170	* README: Many changes that should have gone in before
2171	the last snapshot.
2172	* README.NONPORTABLE: New - referred to by ANNOUNCE
2173	but never created; documents the non-portable routines
2174	included in the library - moved from README with new
2175	routines added.
2176	* ANNOUNCE (pthread_mutexattr_setkind_np): Added to
2177	compliance list.
2178	(pthread_mutexattr_getkind_np): Likewise.
2179
21802001-06-04  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2181
2182	* condvar.c: Add original description of the algorithm as
2183	developed by Terekhov and Thomas, plus reference to
2184	README.CV.
2185
21862001-06-03  Alexander Terekhov <TEREKHOV at de.ibm.com>, Louis Thomas <lthomas at arbitrade.com>
2187
2188	* condvar.c (pthread_cond_init): Completely revamped.
2189	(pthread_cond_destroy): Likewise.
2190	(ptw32_cond_wait_cleanup): Likewise.
2191	(ptw32_cond_timedwait): Likewise.
2192	(ptw32_cond_unblock): New general signaling routine.
2193	(pthread_cond_signal): Now calls ptw32_cond_unblock.
2194	(pthread_cond_broadcast): Likewise.
2195	* implement.h (pthread_cond_t_): Revamped.
2196	* README.CV: New; explanation of the above changes.
2197
21982001-05-30  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2199
2200	* pthread.h (rand_r): Fake using _seed argument to quell
2201	compiler warning (compiler should optimise this away later).
2202
2203	* GNUmakefile (OPT): Leave symbolic information out of the library
2204	and increase optimisation level - for smaller faster prebuilt
2205	dlls.
2206
22072001-05-29  Milan Gardian <Milan.Gardian at LEIBINGER.com>
2208
2209	* Makefile: fix typo.
2210	* pthreads.h: Fix problems with stdcall/cdecl conventions, in particular
2211	remove the need for PT_STDCALL everywhere; remove warning supression.
2212	* (errno): Fix the longstanding "inconsistent dll linkage" problem
2213	with errno; now also works with /MD debugging libs -
2214	warnings emerged when compiling pthreads library with /MD (or /MDd)
2215	compiler switch, instead of /MT (or /MTd) (i.e. when compiling pthreads
2216	using Multithreaded DLL CRT instead of Multithreaded statically linked
2217	CRT).
2218	* create.c (pthread_create): Likewise; fix typo.
2219	* private.c (ptw32_threadStart): Eliminate use of terminate() which doesn't
2220	throw exceptions.
2221	* Remove unnecessary #includes from a number of modules -
2222	[I had to #include malloc.h in implement.h for gcc - rpj].
2223
22242001-05-29  Thomas Pfaff <tpfaff at gmx.net>
2225
2226	* pthread.h (PTHREAD_MUTEX_DEFAULT): New; equivalent to
2227	PTHREAD_MUTEX_DEFAULT_NP.
2228	* (PTHREAD_MUTEX_NORMAL): Similarly.
2229	* (PTHREAD_MUTEX_ERRORCHECK): Similarly.
2230	* (PTHREAD_MUTEX_RECURSIVE): Similarly.
2231	* (pthread_mutex_setdefaultkind_np): New; Linux compatibility stub
2232	for pthread_mutexattr_settype.
2233	* (pthread_mutexattr_getkind_np): New; Linux compatibility stub
2234	for pthread_mutexattr_gettype.
2235	* mutex.c (pthread_mutexattr_settype): New; allow
2236	the following types of mutex:
2237	  PTHREAD_MUTEX_DEFAULT_NP
2238	  PTHREAD_MUTEX_NORMAL_NP
2239	  PTHREAD_MUTEX_ERRORCHECK_NP
2240	  PTHREAD_MUTEX_RECURSIVE_NP
2241	* Note that PTHREAD_MUTEX_DEFAULT is equivalent to
2242	PTHREAD_MUTEX_NORMAL - ie. mutexes should no longer
2243	be recursive by default, and a thread will deadlock if it
2244	tries to relock a mutex it already owns. This is inline with
2245	other pthreads implementations.
2246	* (pthread_mutex_lock): Process the lock request
2247	according to the mutex type.
2248	* (pthread_mutex_init): Eliminate use of Win32 mutexes as the
2249	basis of POSIX mutexes - instead, a combination of one critical section
2250	and one semaphore are used in conjunction with Win32 Interlocked* routines.
2251	* (pthread_mutex_destroy): Likewise.
2252	* (pthread_mutex_lock): Likewise.
2253	* (pthread_mutex_trylock): Likewise.
2254	* (pthread_mutex_unlock): Likewise.
2255	* Use longjmp/setjmp to implement cancelation when building the library
2256	using a C compiler which doesn't support exceptions, e.g. gcc -x c (note
2257	that gcc -x c++ uses exceptions).
2258	* Also fixed some of the same typos and eliminated PT_STDCALL as
2259	Milan Gardian's patches above.
2260
22612001-02-07  Alexander Terekhov <TEREKHOV at de.ibm.com>
2262
2263	* rwlock.c: Revamped.
2264	* implement.h (pthread_rwlock_t_): Redefined.
2265	This implementation does not have reader/writer starvation problem.
2266	Rwlock attempts to behave more like a normal mutex with
2267	races and scheduling policy determining who is more important;
2268	It also supports recursive locking,
2269	has less synchronization overhead (no broadcasts at all,
2270	readers are not blocked on any condition variable) and seem to
2271	be faster than the current implementation [W98 appears to be
2272	approximately 15 percent faster at least - on top of speed increase
2273	from Thomas Pfaff's changes to mutex.c - rpj].
2274
22752000-12-29  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2276
2277	* Makefile: Back-out "for" loops which don't work.
2278
2279	* GNUmakefile: Remove the fake.a target; add the "realclean"
2280	target; don't remove built libs under the "clean" target.
2281
2282	* config.h: Add a guard against multiple inclusion.
2283
2284	* semaphore.h: Add some defines from config.h to make
2285	semaphore.h independent of config.h when building apps.
2286
2287	* pthread.h (_errno): Back-out previous fix until we know how to
2288	fix it properly.
2289
2290	* implement.h (lockCount): Add missing element to pthread_mutex_t_.
2291
2292	* sync.c (pthread_join): Spelling fix in comment.
2293
2294	* private.c (ptw32_threadStart): Reset original termination
2295	function (C++).
2296	(ptw32_threadStart): Cleanup detached threads early in case
2297	the library is statically linked.
2298	(ptw32_callUserDestroyRoutines): Remove [SEH] __try block from
2299	destructor call so that unhandled exceptions will be passed through
2300	to the 	system; call terminate() from [C++] try block for the same
2301	reason.
2302
2303	* tsd.c (pthread_getspecific): Add comment.
2304
2305	* mutex.c (pthread_mutex_init): Initialise new elements in
2306	pthread_mutex_t.
2307	(pthread_mutex_unlock): Invert "pthread_equal()" test.
2308
23092000-12-28  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2310
2311	* semaphore.c (mode_t): Use ifndef HAVE_MODE_T to include definition.
2312
2313	* config.h.in (HAVE_MODE_T): Added.
2314	(_UWIN): Start adding defines for the UWIN package.
2315
2316	* private.c (ptw32_threadStart): Unhandled exceptions are
2317	now passed through to the system to deal with. This is consistent
2318	with normal Windows behaviour. C++ applications may use
2319	set_terminate() to override the default behaviour which is
2320	to call ptw32_terminate(). Ptw32_terminate() cleans up some
2321	POSIX thread stuff before calling the system default function
2322	which calls abort(). The users termination function should conform
2323	to standard C++ semantics which is to not return. It should
2324	exit the thread (call pthread_exit()) or exit the application.
2325	* private.c (ptw32_terminate): Added as the default set_terminate()
2326	function. It calls the system default function after cleaning up
2327	some POSIX thread stuff.
2328
2329	* implement.h (ptw32_try_enter_critical_section): Move
2330	declaration.
2331	* global.c (ptw32_try_enter_critical_section): Moved
2332	from dll.c.
2333	* dll.c: Move process and thread attach/detach code into
2334	functions in nonportable.c.
2335	* nonportable.c (pthread_win32_process_attach_np): Process
2336	attach code from dll.c is now available to static linked
2337	applications.
2338	* nonportable.c (pthread_win32_process_detach_np): Likewise.
2339	* nonportable.c (pthread_win32_thread_attach_np): Likewise.
2340	* nonportable.c (pthread_win32_thread_detach_np): Likewise.
2341
2342	* pthread.h: Add new non-portable prototypes for static
2343	linked applications.
2344
2345	* GNUmakefile (OPT): Increase optimisation flag and remove
2346	debug info flag.
2347
2348	* pthread.def: Add new non-portable exports for static
2349	linked applications.
2350
23512000-12-11  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2352
2353	* FAQ: Update Answer 6 re getting a fully working
2354	Mingw32 built library.
2355
23562000-10-10  Steven Reddie <smr at essemer.com.au>
2357
2358        * misc.c (pthread_self): Restore Win32 "last error"
2359        cleared by TlsGetValue() call in
2360        pthread_getspecific()
2361
23622000-09-20  Arthur Kantor <akantor at bexusa.com>
2363
2364        * mutex.c (pthread_mutex_lock): Record the owner
2365        of the mutex. This requires also keeping count of
2366        recursive locks ourselves rather than leaving it
2367        to Win32 since we need to know when to NULL the
2368        thread owner when the mutex is unlocked.
2369        (pthread_mutex_trylock): Likewise.
2370        (pthread_mutex_unlock): Check that the calling
2371        thread owns the mutex, decrement the recursive
2372        lock count, and NULL the owner if zero. Return
2373        EPERM if the mutex is owned by another thread.
2374        * implement.h (pthread_mutex_t_): Add ownerThread
2375        and lockCount members.
2376
23772000-09-13  Jef Gearhart <jgearhart at tpssys.com>
2378
2379	* mutex.c (pthread_mutex_init): Call
2380	TryEnterCriticalSection through the pointer
2381	rather than directly so that the dll can load
2382	on Windows versions that can't resolve the
2383	function, eg. Windows 95
2384
23852000-09-09  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2386
2387	* pthread.h (ctime_r): Fix arg.
2388
23892000-09-08  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2390
2391	* GNUmakefile(_WIN32_WINNT=0x400): Define in CFLAGS;
2392	doesn't seem to be needed though.
2393
2394	* cancel.c (pthread_cancel): Must get "self" through
2395	calling pthread_self() which will ensure a POSIX thread
2396	struct is built for non-POSIX threads; return an error
2397	if this fails
2398	- Ollie Leahy <ollie at mpt.ie>
2399	(pthread_setcancelstate): Likewise.
2400	(pthread_setcanceltype): Likewise.
2401	* misc.c (ptw32_cancelable_wait): Likewise.
2402
2403	* private.c (ptw32_tkAssocCreate): Remove unused #if 0
2404	wrapped code.
2405
2406	* pthread.h (ptw32_get_exception_services_code):
2407	Needed to be forward declared unconditionally.
2408
24092000-09-06  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2410
2411	* cancel.c (pthread_cancel): If called from the main
2412	thread "self" would be NULL; get "self" via pthread_self()
2413	instead of directly from TLS so that an implicit
2414	pthread object is created.
2415
2416	* misc.c (pthread_equal): Strengthen test for NULLs.
2417
24182000-09-02  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2419
2420	* condvar.c (ptw32_cond_wait_cleanup): Ensure that all
2421	waking threads check if they are the last, and notify
2422	the broadcaster if so - even if an error occurs in the
2423	waiter.
2424
2425	* semaphore.c (_decrease_semaphore): Should be
2426	a call to ptw32_decrease_semaphore.
2427	(_increase_semaphore): Should be a call to
2428	ptw32_increase_semaphore.
2429
2430	* misc.c (ptw32_cancelable_wait): Renamed from
2431	CancelableWait.
2432	* rwlock.c (_rwlock_check*): Renamed to
2433	ptw32_rwlock_check*.
2434	* mutex.c (_mutex_check*): Renamed to ptw32_mutex_check*.
2435	* condvar.c (cond_timed*): Renamed to ptw32_cond_timed*.
2436	(_cond_check*): Renamed to ptw32_cond_check*.
2437	(cond_wait_cleanup*): Rename to ptw32_cond_wait_cleanup*.
2438	(ptw32_cond_timedwait): Add comments.
2439
24402000-08-22  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2441
2442	* private.c (ptw32_throw): Fix exception test;
2443	move exceptionInformation declaration.
2444
2445	* tsd.c (pthread_key_create): newkey wrongly declared.
2446
2447	* pthread.h: Fix comment block.
2448
24492000-08-18  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2450
2451	* mutex.c (pthread_mutex_destroy): Check that the mutex isn't
2452	held; invalidate the mutex as early as possible to avoid
2453	contention; not perfect - FIXME!
2454
2455	* rwlock.c (pthread_rwlock_init): Remove redundant assignment
2456	to "rw".
2457	(pthread_rwlock_destroy): Invalidate the rwlock before
2458	freeing up any of it's resources - to avoid contention.
2459
2460	* private.c (ptw32_tkAssocCreate): Change assoc->lock
2461	to use a dynamically initialised mutex - only consumes
2462	a W32 mutex or critical section when first used,
2463	not before.
2464
2465	* mutex.c (pthread_mutex_init): Remove redundant assignment
2466	to "mx".
2467	(pthread_mutexattr_destroy): Set attribute to NULL
2468	before freeing it's memory - to avoid contention.
2469
2470	* implement.h (PTW32_EPS_CANCEL/PTW32_EPS_EXIT):
2471	Must be defined for all compilers - used as generic
2472	exception selectors by ptw32_throw().
2473
2474	* Several: Fix typos from scripted edit session
2475	yesterday.
2476
2477	* nonportable.c (pthread_mutexattr_setforcecs_np):
2478	Moved this function from mutex.c.
2479	(pthread_getw32threadhandle_np): New function to
2480	return the win32 thread handle that the POSIX
2481	thread is using.
2482	* mutex.c (pthread_mutexattr_setforcecs_np):
2483	Moved to new file "nonportable.c".
2484
2485	* pthread.h (PTW32_BUILD): Only	redefine __except
2486	and catch compiler keywords if we aren't building
2487	the library (ie. PTW32_BUILD is not defined) -
2488	this is safer than defining and then undefining
2489	if not building the library.
2490	* implement.h: Remove __except and catch undefines.
2491	* Makefile (CFLAGS): Define PTW32_BUILD.
2492	* GNUmakefile (CFLAGS): Define PTW32_BUILD.
2493
2494	* All appropriate: Change Pthread_exception* to
2495	ptw32_exception* to be consistent with internal
2496	identifier naming.
2497
2498	* private.c (ptw32_throw): New function to provide
2499	a generic exception throw for all internal
2500	exceptions and EH schemes.
2501	(ptw32_threadStart): pthread_exit() value is now
2502	returned via the thread structure exitStatus
2503	element.
2504	* exit.c (pthread_exit): pthread_exit() value is now
2505	returned via the thread structure exitStatus
2506	element.
2507	* cancel.c (ptw32_cancel_self): Now uses ptw32_throw.
2508	(pthread_setcancelstate): Ditto.
2509	(pthread_setcanceltype): Ditto.
2510	(pthread_testcancel): Ditto.
2511	(pthread_cancel): Ditto.
2512	* misc.c (CancelableWait): Ditto.
2513	* exit.c (pthread_exit): Ditto.
2514	* All applicable: Change PTW32_ prefix to
2515	PTW32_ prefix to remove leading underscores
2516	from private library identifiers.
2517
25182000-08-17  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2519
2520	* All applicable: Change _pthread_ prefix to
2521	ptw32_ prefix to remove leading underscores
2522	from private library identifiers (single
2523	and double leading underscores are reserved in the
2524	ANSI C standard for compiler implementations).
2525
2526	* tsd.c (pthread_create_key): Initialise temporary
2527	key before returning it's address to avoid race
2528	conditions.
2529
25302000-08-13  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2531
2532	* errno.c: Add _MD precompile condition; thus far
2533	had no effect when using /MD compile option but I
2534	thnk it should be there.
2535
2536	* exit.c: Add __cplusplus to various #if lines;
2537	was compiling SEH code even when VC++ had
2538	C++ compile options.
2539
2540	* private.c: ditto.
2541
2542	* create.c (pthread_create): Add PT_STDCALL macro to
2543	function pointer arg in _beginthread().
2544
2545	* pthread.h: PT_STDCALL really does need to be defined
2546	in both this and impliment.h; don't set it to __cdecl
2547	- this macro is only used to extend function pointer
2548	casting for functions that will be passed as parameters.
2549	(~PThreadCleanup): add cast and group expression.
2550	(_errno): Add _MD compile conditional.
2551	(PtW32NoCatchWarn): Change pragma message.
2552
2553	* implement.h: Move and change PT_STDCALL define.
2554
2555	* need_errno.h: Add _MD to compilation conditional.
2556
2557	* GNUmakefile: Substantial rewrite for new naming
2558	convention; set for nil optimisation (turn it up
2559	when we have a working library build; add target
2560	"fake.a" to build a libpthreadw32.a from the VC++
2561	built DLL pthreadVCE.dll.
2562
2563	* pthread.def (LIBRARY): Don't specify in the .def
2564	file - it is specified on the linker command line
2565	since we now use the same .def file for variously
2566	named .dlls.
2567
2568	* Makefile: Substantial rewrite for new naming
2569	convention; default nmake target only issues a
2570	help message; run nmake with specific target
2571	corresponding to the EH scheme being used.
2572
2573	* README: Update information; add naming convention
2574	explanation.
2575
2576	* ANNOUNCE: Update information.
2577
25782000-08-12  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2579
2580	* pthread.h: Add compile-time message when using
2581	MSC_VER compiler and C++ EH to warn application
2582	programmers to use PtW32Catch instead of catch(...)
2583	if they want cancelation and pthread_exit to work.
2584
2585	* implement.h: Remove #include <semaphore.h>; we
2586	use our own local semaphore.h.
2587
25882000-08-10  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2589
2590	* cleanup.c (pthread_pop_cleanup): Remove _pthread
2591	prefix from __except and catch keywords; implement.h
2592	now simply undefines ptw32__except and
2593	ptw32_catch if defined; VC++ was not textually
2594	substituting ptw32_catch etc back to catch as
2595	it was redefined; the reason for using the prefixed
2596	version was to make it clear that it was not using
2597	the pthread.h redefined catch keyword.
2598
2599	* private.c (ptw32_threadStart): Ditto.
2600	(ptw32_callUserDestroyRoutines): Ditto.
2601
2602	* implement.h (ptw32__except): Remove #define.
2603	(ptw32_catch): Remove #define.
2604
2605	* GNUmakefile (pthread.a): New target to build
2606	libpthread32.a from pthread.dll using dlltool.
2607
2608	* buildlib.bat: Duplicate cl commands with args to
2609	build C++ EH version of pthread.dll; use of .bat
2610	files is redundant now that nmake compatible
2611	Makefile is included; used as a kludge only now.
2612
2613	* Makefile: Localise some macros and fix up the clean:
2614	target to extend it and work properly.
2615
2616	* CONTRIBUTORS: Add contributors.
2617
2618	* ANNOUNCE: Updated.
2619
2620	* README: Updated.
2621
26222000-08-06  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2623
2624	* pthread.h: Remove #warning - VC++ doesn't accept it.
2625
26262000-08-05  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2627
2628	* pthread.h (PtW32CatchAll): Add macro. When compiling
2629	applications using VC++ with C++ EH rather than SEH
2630	'PtW32CatchAll' must be used in place of any 'catch( ... )'
2631	if the application wants pthread cancelation or
2632	pthread_exit() to work.
2633
26342000-08-03  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2635
2636	* pthread.h: Add a base class ptw32_exception for
2637	library internal exceptions and change the "catch"
2638	re-define macro to use it.
2639
26402000-08-02  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2641
2642	* GNUmakefile (CFLAGS): Add -mthreads.
2643	Add new targets to generate cpp and asm output.
2644
2645	* sync.c (pthread_join): Remove dead code.
2646
26472000-07-25  Tristan Savatier <tristan at mpegtv.com>
2648
2649	* sched.c (sched_get_priority_max): Handle different WinCE and
2650	Win32 priority values together.
2651	(sched_get_priority_min): Ditto.
2652
26532000-07-25  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2654
2655	* create.c (pthread_create): Force new threads to wait until
2656	pthread_create has the new thread's handle; we also retain
2657	a local copy of the handle for internal use until
2658	pthread_create returns.
2659
2660	* private.c (ptw32_threadStart): Initialise ei[].
2661	(ptw32_threadStart): When beginthread is used to start the
2662	thread, force waiting until the creator thread had the
2663	thread handle.
2664
2665	* cancel.c (ptw32_cancel_thread): Include context switch
2666	code for defined(_X86_) environments in addition to _M_IX86.
2667
2668	* rwlock.c (pthread_rwlock_destroy): Assignment changed
2669	to avoid compiler warning.
2670
2671	* private.c (ptw32_get_exception_services_code): Cast
2672	NULL return value to avoid compiler warning.
2673
2674	* cleanup.c (pthread_pop_cleanup): Initialise "cleanup" variable
2675	to avoid compiler warnings.
2676
2677	* misc.c (ptw32_new): Change "new" variable to "t" to avoid
2678	confusion with the C++ keyword of the same name.
2679
2680	* condvar.c (cond_wait_cleanup): Initialise lastWaiter variable.
2681	(cond_timedwait): Remove unused local variables. to avoid
2682	compiler warnings.
2683
2684	* dll.c (dllMain): Remove 2000-07-21 change - problem
2685	appears to be in pthread_create().
2686
26872000-07-22  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2688
2689	* tsd.c (pthread_key_create): If a destructor was given
2690	and the pthread_mutex_init failed, then would try to
2691	reference a NULL pointer (*key); eliminate this section of
2692	code by using a dynamically initialised mutex
2693	(PTHREAD_MUTEX_INITIALIZER).
2694
2695	* tsd.c (pthread_setspecific): Return an error if
2696	unable to set the value; simplify cryptic conditional.
2697
2698	* tsd.c (pthread_key_delete): Locking threadsLock relied
2699	on mutex_lock returning an error if the key has no destructor.
2700	ThreadsLock is only initialised if the key has a destructor.
2701	Making this mutex a static could reduce the number of mutexes
2702	used by an application since it is actually created only at
2703	first use and it's often destroyed soon after.
2704
27052000-07-22  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2706
2707	* FAQ: Added Q5 and Q6.
2708
27092000-07-21  David Baggett <dmb at itasoftware.com>
2710
2711	* dll.c: Include resource leakage work-around. This is a
2712	partial FIXME which doesn't stop all leakage. The real
2713	problem needs to be found and fixed.
2714
27152000-07-21  Ross Johnson  <rpj at setup1.ise.canberra.edu.au>
2716
2717	* create.c (pthread_create): Set threadH to 0 (zero)
2718	everywhere. Some assignments were using NULL. Maybe
2719	it should be NULL everywhere - need to check. (I know
2720	they are nearly always the same thing - but not by
2721	definition.)
2722
2723	* misc.c (pthread_self): Try to catch NULL thread handles
2724	at the point where they might be generated, even though
2725	they should always be valid at this point.
2726
2727	* tsd.c (pthread_setspecific): return an error value if
2728	pthread_self() returns NULL.
2729
2730	* sync.c (pthread_join): return an error value if
2731	pthread_self() returns NULL.
2732
2733	* signal.c (pthread_sigmask): return an error value if
2734	pthread_self() returns NULL.
2735
27362000-03-02  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2737
2738	* attr.c (pthread_attr_init): Set default stacksize to zero (0)
2739	rather than PTHREAD_STACK_MIN even though these are now the same.
2740
2741	* pthread.h (PTHREAD_STACK_MIN): Lowered to 0.
2742
27432000-01-28  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2744
2745	* mutex.c (pthread_mutex_init): Free mutex if it has been alloced;
2746	if critical sections can be used instead of Win32 mutexes, test
2747	that the critical section works and return an error if not.
2748
27492000-01-07  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2750
2751	* cleanup.c (pthread_pop_cleanup): Include SEH code only if MSC is not
2752	compiling as C++.
2753	(pthread_push_cleanup): Include SEH code only if MSC is not
2754	compiling as C++.
2755
2756	* pthread.h: Include SEH code only if MSC is not
2757	compiling as C++.
2758
2759	* implement.h: Include SEH code only if MSC is not
2760	compiling as C++.
2761
2762	* cancel.c (ptw32_cancel_thread): Add _M_IX86 check.
2763	(pthread_testcancel): Include SEH code only if MSC is not
2764	compiling as C++.
2765	(ptw32_cancel_self): Include SEH code only if MSC is not
2766	compiling as C++.
2767
27682000-01-06  Erik Hensema <erik.hensema at group2000.nl>
2769
2770	* Makefile: Remove inconsistencies in 'cl' args
2771
27722000-01-04  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2773
2774	* private.c (ptw32_get_exception_services_code): New; returns
2775	value of EXCEPTION_PTW32_SERVICES.
2776	(ptw32_processInitialize): Remove initialisation of
2777	ptw32_exception_services which is no longer needed.
2778
2779	* pthread.h (ptw32_exception_services): Remove extern.
2780	(ptw32_get_exception_services_code): Add function prototype;
2781	use this to return EXCEPTION_PTW32_SERVICES value instead of
2782	using the ptw32_exception_services variable which I had
2783	trouble exporting through pthread.def.
2784
2785	* global.c (ptw32_exception_services): Remove declaration.
2786
27871999-11-22  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2788
2789	* implement.h: Forward declare ptw32_new();
2790
2791	* misc.c (ptw32_new): New; alloc and initialise a new pthread_t.
2792	(pthread_self): New thread struct is generated 	by new routine
2793	ptw32_new().
2794
2795	* create.c (pthread_create): New thread struct is generated
2796	by new routine ptw32_new().
2797
27981999-11-21  Ross Johnson  <rpj at special.ise.canberra.edu.au>
2799
2800	* global.c (ptw32_exception_services): Declare new variable.
2801
2802	* private.c (ptw32_threadStart): Destroy thread's
2803	cancelLock mutex; make 'catch' and '__except' usageimmune to
2804	redfinitions in pthread.h.
2805	(ptw32_processInitialize): Init new constant ptw32_exception_services.
2806
2807	* create.c (pthread_create): Initialise thread's cancelLock
2808	mutex.
2809
2810	* cleanup.c (pthread_pop_cleanup): Make 'catch' and '__except'
2811	usage immune to redfinition s in pthread.h.
2812
2813	* private.c: Ditto.
2814
2815	* pthread.h (catch): Redefine 'catch' so that C++ applications
2816	won't catch our internal exceptions.
2817	(__except): ditto for __except.
2818
2819	* implement.h (ptw32_catch): Define internal version
2820	of 'catch' because 'catch' is redefined by pthread.h.
2821	(__except): ditto for __except.
2822	(struct pthread_t_): Add cancelLock mutex for async cancel
2823	safety.
2824
28251999-11-21  Jason Nye <jnye at nbnet.nb.ca>, Erik Hensema <erik.hensema at group2000.nl>
2826
2827	* cancel.c (ptw32_cancel_self): New; part of the async
2828	cancellation implementation.
2829	(ptw32_cancel_thread): Ditto; this function is X86
2830	processor specific.
2831	(pthread_setcancelstate): Add check for pending async
2832	cancel request and cancel the calling thread if
2833	required; add async-cancel safety lock.
2834	(pthread_setcanceltype): Ditto.
2835
28361999-11-13  Erik Hensema <erik.hensema at group2000.nl>
2837
2838	* configure.in (AC_OUTPUT): Put generated output into GNUmakefile
2839	rather than Makefile. Makefile will become the MSC nmake compatible
2840	version
2841
28421999-11-13  John Bossom (John.Bossom@cognos.com>
2843
2844	* misc.c (pthread_self): Add a note about GetCurrentThread
2845	returning a pseudo-handle
2846
28471999-11-10  Todd Owen <towen at lucidcalm.dropbear.id.au>
2848
2849	* dll.c (dllMain): Free kernel32 ASAP.
2850	If TryEnterCriticalSection is not being used, then free
2851	the kernel32.dll handle now, rather than leaving it until
2852	DLL_PROCESS_DETACH.
2853
2854	Note: this is not a pedantic exercise in freeing unused
2855	resources!  It is a work-around for a bug in Windows 95
2856	(see microsoft knowledge base article, Q187684) which
2857	does Bad Things when FreeLibrary is called within
2858	the DLL_PROCESS_DETACH code, in certain situations.
2859	Since w95 just happens to be a platform which does not
2860	provide TryEnterCriticalSection, the bug will be
2861	effortlessly avoided.
2862
28631999-11-10  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
2864
2865	* sync.c (pthread_join): Make it a deferred cancelation point.
2866
2867	* misc.c (pthread_self): Explicitly initialise implicitly
2868	created thread state to default values.
2869
28701999-11-05  Tristan Savatier <tristan at mpegtv.com>
2871
2872	* pthread.h (winsock.h): Include unconditionally.
2873	(ETIMEDOUT): Change fallback value to that defined by winsock.h.
2874
2875	* general: Patched for portability to WinCE. The details are
2876	described in the file WinCE-PORT. Follow the instructions
2877	in README.WinCE to make the appropriate changes in config.h.
2878
28791999-10-30  Erik Hensema <erik.hensema at group2000.nl>
2880
2881	* create.c (pthread_create): Explicitly initialise thread state to
2882	default values.
2883
2884	* cancel.c (pthread_setcancelstate): Check for NULL 'oldstate'
2885	for compatibility with Solaris pthreads;
2886	(pthread_setcanceltype): ditto:
2887
28881999-10-23  Erik Hensema <erik.hensema at group2000.nl>
2889
2890	* pthread.h (ctime_r): Fix incorrect argument "_tm"
2891
28921999-10-21  Aurelio Medina <aureliom at crt.com>
2893
2894	* pthread.h (_POSIX_THREADS): Only define it if it isn't
2895	already defined. Projects may need to define this on
2896	the CC command line under Win32 as it doesn't have unistd.h
2897
28981999-10-17  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
2899
2900	* rwlock.c (pthread_rwlock_destroy): Add cast to remove compile
2901	warning.
2902
2903	* condvar.c (pthread_cond_broadcast): Only release semaphores
2904	if there are waiting threads.
2905
29061999-10-15  Lorin Hochstein <lmh at xiphos.ca>, Peter Slacik <Peter.Slacik at tatramed.sk>
2907
2908	* condvar.c (cond_wait_cleanup): New static cleanup handler for
2909	cond_timedwait;
2910	(cond_timedwait): pthread_cleanup_push args changed;
2911	canceling a thread while it's in pthread_cond_wait
2912	will now decrement the waiters count and cleanup if it's the
2913	last waiter.
2914
29151999-10-15  Graham Dumpleton <Graham.Dumpleton at ra.pad.otc.telstra.com.au>
2916
2917	* condvar.c (cond_wait_cleanup): the last waiter will now reset the CV's
2918	wasBroadcast flag
2919
2920Thu Sep 16 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
2921
2922	* rwlock.c (pthread_rwlock_destroy): Add serialisation.
2923	(_rwlock_check_need_init): Check for detroyed rwlock.
2924	* rwlock.c: Check return codes from _rwlock_check_need_init();
2925	modify comments; serialise access to rwlock objects during
2926	operations; rename rw_mutex to rw_lock.
2927	* implement.h: Rename rw_mutex to rw_lock.
2928	* mutex.c (pthread_mutex_destroy): Add serialisation.
2929	(_mutex_check_need_init): Check for detroyed mutex.
2930	* condvar.c (pthread_cond_destroy): Add serialisation.
2931	(_cond_check_need_init): Check for detroyed condvar.
2932	* mutex.c: Modify comments.
2933	* condvar.c: Modify comments.
2934
29351999-08-10  Aurelio Medina  <aureliom at crt.com>
2936
2937	* implement.h (pthread_rwlock_t_): Add.
2938	* pthread.h (pthread_rwlock_t): Add.
2939	(PTHREAD_RWLOCK_INITIALIZER): Add.
2940	Add rwlock function prototypes.
2941	* rwlock.c: New module.
2942	* pthread.def: Add new rwlock functions.
2943	* private.c (ptw32_processInitialize): initialise
2944	ptw32_rwlock_test_init_lock critical section.
2945	* global.c (ptw32_rwlock_test_init_lock): Add.
2946
2947	* mutex.c (pthread_mutex_destroy): Don't free mutex memory
2948	if mutex is PTHREAD_MUTEX_INITIALIZER and has not been
2949	initialised yet.
2950
29511999-08-08 Milan Gardian <mg at tatramed.sk>
2952
2953	* mutex.c (pthread_mutex_destroy): Free mutex memory.
2954
29551999-08-22  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
2956
2957	* exit.c (pthread_exit): Fix reference to potentially
2958	uninitialised pointer.
2959
29601999-08-21  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
2961
2962	* private.c (ptw32_threadStart): Apply fix of 1999-08-19
2963	this time to C++ and non-trapped C versions. Ommitted to
2964	do this the first time through.
2965
29661999-08-19  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
2967
2968	* private.c (ptw32_threadStart): Return exit status from
2969	the application thread startup routine.
2970	- Milan Gardian <mg at tatramed.sk>
2971
29721999-08-18  John Bossom <john.Bossom at cognos.com>
2973
2974	* exit.c (pthread_exit): Put status into pthread_t->exitStatus
2975	* private.c (ptw32_threadStart): Set pthread->exitStatus
2976	on exit of try{} block.
2977	* sync.c (pthread_join): use pthread_exitStatus value if the
2978	thread exit doesn't return a value (for Mingw32 CRTDLL
2979	which uses endthread instead of _endthreadex).
2980
2981Tue Aug 17 20:17:58 CDT 1999  Mumit Khan  <khan at xraylith.wisc.edu>
2982
2983        * create.c (pthread_create): Add CRTDLL suppport.
2984        * exit.c (pthread_exit): Likewise.
2985        * private.c (ptw32_threadStart): Likewise.
2986        (ptw32_threadDestroy): Likewise.
2987        * sync.c (pthread_join): Likewise.
2988        * tests/join1.c (main): Warn about partial support for CRTDLL.
2989
2990Tue Aug 17 20:00:08 1999  Mumit Khan  <khan at xraylith.wisc.edu>
2991
2992        * Makefile.in (LD): Delete entry point.
2993        * acconfig.h (STDCALL): Delete unused macro.
2994        * configure.in: Remove test for STDCALL.
2995        * config.h.in: Regenerate.
2996        * errno.c (_errno): Fix self type.
2997        * pthread.h (PT_STDCALL): Move from here to
2998        * implement.h (PT_STDCALL): here.
2999        (ptw32_threadStart): Fix prototype.
3000        * private.c (ptw32_threadStart): Likewise.
3001
30021999-08-14  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3003
3004	* exit.c (pthread_exit): Don't call pthread_self() but
3005	get thread handle directly from TSD for efficiency.
3006
30071999-08-12  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3008
3009	* private.c (ptw32_threadStart): ei[] only declared if _MSC_VER.
3010
3011	* exit.c (pthread_exit): Check for implicitly created threads
3012	to avoid raising an unhandled exception.
3013
30141999-07-12  Peter Slacik <Peter.Slacik at tatramed.sk>
3015
3016	* condvar.c (pthread_cond_destroy): Add critical section.
3017	(cond_timedwait): Add critical section; check for timeout
3018	waiting on semaphore.
3019	(pthread_cond_broadcast): Add critical section.
3020
30211999-07-09  Lorin Hochstein <lmh at xiphos.ca>, John Bossom <John.Bossom at Cognos.COM>
3022
3023	The problem was that cleanup handlers were not executed when
3024	pthread_exit() was called.
3025
3026	* implement.h (pthread_t_): Add exceptionInformation element for
3027	C++ per-thread exception information.
3028	(general): Define and rename exceptions.
3029
30301999-07-09  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3031
3032	* misc.c (CancelableWait):  PTW32_EPS_CANCEL (SEH) and
3033	ptw32_exception_cancel (C++) used to identify the exception.
3034
3035	* cancel.c (pthread_testcancel): PTW32_EPS_CANCEL (SEH) and
3036	ptw32_exception_cancel (C++) used to identify the exception.
3037
3038	* exit.c (pthread_exit): throw/raise an exception to return to
3039	ptw32_threadStart() to exit the thread. PTW32_EPS_EXIT (SEH)
3040	and ptw32_exception_exit (C++) used to identify the exception.
3041
3042	* private.c (ptw32_threadStart): Add pthread_exit exception trap;
3043	clean up and exit the thread directly rather than via pthread_exit().
3044
3045Sun May 30 00:25:02 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3046
3047	* semaphore.h (mode_t): Conditionally typedef it.
3048
3049Fri May 28 13:33:05 1999  Mark E. Armstrong <avail at pacbell.net>
3050
3051	* condvar.c (pthread_cond_broadcast): Fix possible memory fault
3052
3053Thu May 27 13:08:46 1999  Peter Slacik <Peter.Slacik at tatramed.sk>
3054
3055	* condvar.c (pthread_cond_broadcast): Fix logic bug
3056
3057Thu May 27 13:08:46 1999  Bossom, John <John.Bossom at Cognos.COM>
3058
3059	* condvar.c (pthread_cond_broadcast): optimise sem_post loop
3060
3061Fri May 14 12:13:18 1999  Mike Russo <miker at eai.com>
3062
3063	* attr.c (pthread_attr_setdetachstate): Fix logic bug
3064
3065Sat May  8 09:42:30 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3066
3067	* pthread.def (sem_open): Add.
3068	(sem_close): Add.
3069	(sem_unlink): Add.
3070	(sem_getvalue): Add.
3071
3072	* FAQ (Question 3): Add.
3073
3074Thu Apr  8 01:16:23 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3075
3076	* semaphore.c (sem_open): New function; returns an error (ENOSYS).
3077	(sem_close): ditto.
3078	(sem_unlink): ditto.
3079	(sem_getvalue): ditto.
3080
3081	* semaphore.h (_POSIX_SEMAPHORES): define.
3082
3083Wed Apr  7 14:09:52 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
3084
3085	* errno.c (_REENTRANT || _MT): Invert condition.
3086
3087	* pthread.h (_errno): Conditionally include prototype.
3088
3089Wed Apr  7 09:37:00 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3090
3091	* *.c (comments): Remove individual attributions - these are
3092	documented sufficiently elsewhere.
3093
3094	* implement.h (pthread.h): Remove extraneous include.
3095
3096Sun Apr  4 11:05:57 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3097
3098	* sched.c (sched.h): Include.
3099
3100	* sched.h: New file for POSIX 1b scheduling.
3101
3102	* pthread.h: Move opaque structures to implement.h; move sched_*
3103	prototypes out and into sched.h.
3104
3105	* implement.h: Add opaque structures from pthread.h.
3106
3107	* sched.c (sched_yield): New function.
3108
3109	* condvar.c (ptw32_sem_*): Rename to sem_*; except for
3110	ptw32_sem_timedwait which is an private function.
3111
3112Sat Apr  3 23:28:00 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3113
3114	* Makefile.in (OBJS): Add errno.o.
3115
3116Fri Apr  2 11:08:50 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3117
3118	* implement.h (ptw32_sem_*): Remove prototypes now defined in
3119	semaphore.h.
3120
3121	* pthread.h (sempahore.h): Include.
3122
3123	* semaphore.h: New file for POSIX 1b semaphores.
3124
3125	* semaphore.c (ptw32_sem_timedwait): Moved to private.c.
3126
3127	* pthread.h (ptw32_sem_t): Change to sem_t.
3128
3129	* private.c (ptw32_sem_timedwait): Moved from semaphore.c;
3130	set errno on error.
3131
3132	* pthread.h (pthread_t_): Add per-thread errno element.
3133
3134Fri Apr  2 11:08:50 1999  John Bossom <jebossom at cognos.com>
3135
3136	* semaphore.c (ptw32_sem_*): Change to sem_*; these functions
3137	will be exported from the library; set errno on error.
3138
3139	* errno.c (_errno): New file. New function.
3140
3141Fri Mar 26 14:11:45 1999  Tor Lillqvist <tml at iki.fi>
3142
3143	* semaphore.c (ptw32_sem_timedwait): Check for negative
3144	milliseconds.
3145
3146Wed Mar 24 11:32:07 1999  John Bossom <jebossom at cognos.com>
3147
3148	* misc.c (CancelableWait): Initialise exceptionInformation[2].
3149	(pthread_self): Get a real Win32 thread handle for implicit threads.
3150
3151	* cancel.c (pthread_testcancel): Initialise exceptionInformation[2].
3152
3153	* implement.h (SE_INFORMATION): Fix values.
3154
3155	* private.c (ptw32_threadDestroy): Close the thread handle.
3156
3157Fri Mar 19 12:57:27 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
3158
3159	* cancel.c (comments): Update and cleanup.
3160
3161Fri Mar 19 09:12:59 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3162
3163	* private.c (ptw32_threadStart): status returns PTHREAD_CANCELED.
3164
3165	* pthread.h (PTHREAD_CANCELED): defined.
3166
3167Tue Mar 16  1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3168
3169	* all: Add GNU LGPL and Copyright and Warranty.
3170
3171Mon Mar 15 00:20:13 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3172
3173	* condvar.c (pthread_cond_init): fix possible uninitialised use
3174	of cv.
3175
3176Sun Mar 14 21:01:59 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3177
3178	* condvar.c (pthread_cond_destroy): don't do full cleanup if
3179	static initialised cv has never been used.
3180	(cond_timedwait): check result of auto-initialisation.
3181
3182Thu Mar 11 09:01:48 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3183
3184	* pthread.h (pthread_mutex_t): revert to (pthread_mutex_t *);
3185	define a value to serve as PTHREAD_MUTEX_INITIALIZER.
3186	(pthread_mutex_t_): remove staticinit and valid elements.
3187	(pthread_cond_t): revert to (pthread_cond_t_ *);
3188	define a value to serve as PTHREAD_COND_INITIALIZER.
3189	(pthread_cond_t_): remove staticinit and valid elements.
3190
3191	* mutex.c (pthread_mutex_t args): adjust indirection of references.
3192	(all functions): check for PTHREAD_MUTEX_INITIALIZER value;
3193	check for NULL (invalid).
3194
3195	* condvar.c (pthread_cond_t args): adjust indirection of references.
3196	(all functions): check for PTHREAD_COND_INITIALIZER value;
3197	check for NULL (invalid).
3198
3199Wed Mar 10 17:18:12 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3200
3201	* misc.c (CancelableWait): Undo changes from Mar 8 and 7.
3202
3203Mon Mar  8 11:18:59 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3204
3205	* misc.c (CancelableWait): Ensure cancelEvent handle is the lowest
3206	indexed element in the handles array. Enhance test for abandoned
3207	objects.
3208
3209	* pthread.h (PTHREAD_MUTEX_INITIALIZER): Trailing elements not
3210	initialised are set to zero by the compiler. This avoids the
3211	problem of initialising the opaque critical section element in it.
3212	(PTHREAD_COND_INITIALIZER): Ditto.
3213
3214	* semaphore.c (ptw32_sem_timedwait): Check sem == NULL earlier.
3215
3216Sun Mar  7 12:31:14 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3217
3218	* condvar.c (pthread_cond_init): set semaphore initial value
3219	to 0, not 1. cond_timedwait was returning signaled immediately.
3220
3221	* misc.c (CancelableWait): Place the cancel event handle first
3222	in the handle table for WaitForMultipleObjects. This ensures that
3223	the cancel event is recognised and acted apon if both objects
3224	happen to be signaled together.
3225
3226	* private.c (ptw32_cond_test_init_lock): Initialise and destroy.
3227
3228	* implement.h (ptw32_cond_test_init_lock): Add extern.
3229
3230	* global.c (ptw32_cond_test_init_lock): Add declaration.
3231
3232	* condvar.c (pthread_cond_destroy): check for valid initialised CV;
3233	flag destroyed CVs as invalid.
3234	(pthread_cond_init): pthread_cond_t is no longer just a pointer.
3235	This is because PTHREAD_COND_INITIALIZER needs state info to reside
3236	in pthread_cond_t so that it can initialise on first use. Will work on
3237	making pthread_cond_t (and other objects like it) opaque again, if
3238	possible, later.
3239	(cond_timedwait): add check for statically initialisation of
3240	CV; initialise on first use.
3241	(pthread_cond_signal): check for valid CV.
3242	(pthread_cond_broadcast): check for valid CV.
3243	(_cond_check_need_init): Add.
3244
3245	* pthread.h (PTHREAD_COND_INITIALIZER): Fix.
3246	(pthread_cond_t): no longer a pointer to pthread_cond_t_.
3247	(pthread_cond_t_): add 'staticinit' and 'valid' elements.
3248
3249Sat Mar 6 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3250
3251	* implement.h: Undate comments.
3252
3253Sun Feb 21 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3254
3255	* pthread.h (PTHREAD_MUTEX_INITIALIZER): missing braces around
3256	cs element initialiser.
3257
32581999-02-21  Ben Elliston  <bje at cygnus.com>
3259
3260	* pthread.h (pthread_exit): The return type of this function is
3261	void, not int.
3262
3263	* exit.c (pthread_exit): Do not return 0.
3264
3265Sat Feb 20 16:03:30 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3266
3267	* dll.c (DLLMain): Expand TryEnterCriticalSection support test.
3268
3269	* mutex.c (pthread_mutex_trylock): The check for
3270	ptw32_try_enter_critical_section == NULL should have been
3271	removed long ago.
3272
3273Fri Feb 19 16:03:30 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3274
3275	* sync.c (pthread_join): Fix pthread_equal() test.
3276
3277	* mutex.c (pthread_mutex_trylock): Check mutex != NULL before
3278	using it.
3279
3280Thu Feb 18 16:17:30 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3281
3282	* misc.c (pthread_equal): Fix inverted result.
3283
3284	* Makefile.in: Use libpthread32.a as the name of the DLL export
3285	library instead of pthread.lib.
3286
3287	* condvar.c (pthread_cond_init): cv could have been used unitialised;
3288	initialise.
3289
3290	* create.c (pthread_create): parms could have been used unitialised;
3291	initialise.
3292
3293	* pthread.h (struct pthread_once_t_): Remove redefinition.
3294
3295Sat Feb 13 03:03:30 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3296
3297	* pthread.h (struct pthread_once_t_): Replaced.
3298
3299	* misc.c (pthread_once): Replace with John Bossom's version;
3300	has lighter weight serialisation; fixes problem of not holding
3301	competing threads until after the init_routine completes.
3302
3303Thu Feb 11 13:34:14 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3304
3305	* misc.c (CancelableWait): Change C++ exception throw.
3306
3307	* sync.c (pthread_join): Change FIXME comment - issue resolved.
3308
3309Wed Feb 10 12:49:11 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3310
3311	* configure: Various temporary changes.
3312	- Kevin Ruland <Kevin.Ruland at anheuser-busch.com>
3313
3314	* README: Update.
3315
3316	* pthread.def (pthread_attr_getstackaddr): uncomment
3317	(pthread_attr_setstackaddr): uncomment
3318
3319Fri Feb  5 13:42:30 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
3320
3321	* semaphore.c: Comment format changes.
3322
3323Thu Feb  4 10:07:28 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3324
3325	* global.c: Remove ptw32_exception instantiation.
3326
3327	* cancel.c (pthread_testcancel): Change C++ exception throw.
3328
3329	* implement.h: Remove extern declaration.
3330
3331Wed Feb  3 13:04:44 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
3332
3333	* cleanup.c: Rename ptw32_*_cleanup() to pthread_*_cleanup().
3334
3335	* pthread.def: Ditto.
3336
3337	* pthread.h: Ditto.
3338
3339	* pthread.def (pthread_cleanup_push): Remove from export list;
3340	the function is defined as a macro under all compilers.
3341	(pthread_cleanup_pop): Ditto.
3342
3343	* pthread.h: Remove #if defined().
3344
3345Wed Feb  3 10:13:48 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3346
3347	* sync.c (pthread_join): Check for NULL value_ptr arg;
3348	check for detached threads.
3349
3350Tue Feb  2 18:07:43 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
3351
3352	* implement.h: Add #include <pthread.h>.
3353	Change sem_t to ptw32_sem_t.
3354
3355Tue Feb  2 18:07:43 1999  Kevin Ruland <Kevin.Ruland at anheuser-busch.com>
3356
3357	* signal.c (pthread_sigmask): Add and modify casts.
3358	Reverse LHS/RHS bitwise assignments.
3359
3360	* pthread.h: Remove #include <semaphore.h>.
3361	(PTW32_ATTR_VALID): Add cast.
3362	(struct pthread_t_): Add sigmask element.
3363
3364	* dll.c: Add "extern C" for DLLMain.
3365	(DllMain): Add cast.
3366
3367	* create.c (pthread_create): Set sigmask in thread.
3368
3369	* condvar.c: Remove #include. Change sem_* to ptw32_sem_*.
3370
3371	* attr.c: Changed #include.
3372
3373	* Makefile.in: Additional targets and changes to build the library
3374	as a DLL.
3375
3376Fri Jan 29 11:56:28 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
3377
3378	* Makefile.in (OBJS): Add semaphore.o to list.
3379
3380	* semaphore.c (ptw32_sem_timedwait): Move from private.c.
3381	Rename sem_* to ptw32_sem_*.
3382
3383	* pthread.h (pthread_cond_t): Change type of sem_t.
3384	_POSIX_SEMAPHORES no longer defined.
3385
3386	* semaphore.h: Contents moved to implement.h.
3387	Removed from source tree.
3388
3389	* implement.h: Add semaphore function prototypes and rename all
3390	functions to prepend 'ptw32_'. They are
3391	now private to the pthreads-win32 implementation.
3392
3393	* private.c: Change #warning.
3394	Move ptw32_sem_timedwait() to semaphore.c.
3395
3396	* cleanup.c: Change #warning.
3397
3398	* misc.c: Remove #include <errno.h>
3399
3400	* pthread.def: Cleanup CVS merge conflicts.
3401
3402	* global.c: Ditto.
3403
3404	* ChangeLog: Ditto.
3405
3406	* cleanup.c: Ditto.
3407
3408Sun Jan 24 01:34:52 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3409
3410	* semaphore.c (sem_wait): Remove second arg to
3411	pthreadCancelableWait() call.
3412
3413Sat Jan 23 17:36:40 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3414
3415	* pthread.def: Add new functions to export list.
3416
3417	* pthread.h (PTHREAD_MUTEX_AUTO_CS_NP): New.
3418	(PTHREAD_MUTEX_FORCE_CS_NP): New.
3419
3420	* README: Updated.
3421
3422Fri Jan 22 14:31:59 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
3423
3424	* Makefile.in (CFLAGS): Remove -fhandle-exceptions. Not needed
3425	with egcs. Add -g for debugging.
3426
3427	* create.c (pthread_create): Replace __stdcall with PT_STDCALL
3428	macro. This is a hack and must be fixed.
3429
3430	* misc.c (CancelableWait): Remove redundant statement.
3431
3432	* mutex.c (pthread_mutexattr_init): Cast calloc return value.
3433
3434	* misc.c (CancelableWait): Add cast.
3435	(pthread_self): Add cast.
3436
3437	* exit.c (pthread_exit): Add cast.
3438
3439	* condvar.c (pthread_condattr_init): Cast calloc return value.
3440
3441	* cleanup.c: Reorganise conditional compilation.
3442
3443	* attr.c (pthread_attr_init): Remove unused 'result'.
3444	Cast malloc return value.
3445
3446	* private.c (ptw32_callUserDestroyRoutines): Redo conditional
3447	compilation.
3448
3449	* misc.c (CancelableWait): C++ version uses 'throw'.
3450
3451	* cancel.c (pthread_testcancel): Ditto.
3452
3453	* implement.h (class ptw32_exception): Define for C++.
3454
3455	* pthread.h: Fix C, C++, and Win32 SEH condition compilation
3456	mayhem around pthread_cleanup_* defines. C++ version now uses John
3457	Bossom's cleanup handlers.
3458	(pthread_attr_t): Make 'valid' unsigned.
3459	Define '_timeb' as 'timeb' for Ming32.
3460	Define PT_STDCALL as nothing for Mingw32. May be temporary.
3461
3462	* cancel.c (pthread_testcancel): Cast return value.
3463
3464Wed Jan 20 09:31:28 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3465
3466	* pthread.h (pthread_mutexattr_t): Changed to a pointer.
3467
3468	* mutex.c (pthread_mutex_init): Conditionally create Win32 mutex
3469	- from John Bossom's implementation.
3470	(pthread_mutex_destroy): Conditionally close Win32 mutex
3471	- from John Bossom's implementation.
3472	(pthread_mutexattr_init): Replaced by John Bossom's version.
3473	(pthread_mutexattr_destroy): Ditto.
3474	(pthread_mutexattr_getpshared): New function from John Bossom's
3475	implementation.
3476	(pthread_mutexattr_setpshared): New function from John Bossom's
3477	implementation.
3478
3479Tue Jan 19 18:27:42 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
3480
3481	* pthread.h (pthreadCancelableTimedWait): New prototype.
3482	(pthreadCancelableWait): Remove second argument.
3483
3484	* misc.c (CancelableWait): New static function is
3485	pthreadCancelableWait() renamed.
3486	(pthreadCancelableWait): Now just calls CancelableWait() with
3487	INFINITE timeout.
3488	(pthreadCancelableTimedWait): Just calls CancelableWait()
3489	with passed in timeout.
3490
3491Tue Jan 19 18:27:42 1999  Scott Lightner <scott at curriculum.com>
3492
3493	* private.c (ptw32_sem_timedwait): 'abstime' arg really is
3494	absolute time. Calculate relative time to wait from current
3495	time before passing timeout to new routine
3496	pthreadCancelableTimedWait().
3497
3498Tue Jan 19 10:27:39 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3499
3500	* pthread.h (pthread_mutexattr_setforcecs_np): New prototype.
3501
3502	* mutex.c (pthread_mutexattr_init): Init 'pshared' and 'forcecs'
3503	attributes to 0.
3504	(pthread_mutexattr_setforcecs_np): New function (not portable).
3505
3506	* pthread.h (pthread_mutex_t):
3507	Add 'mutex' element. Set to NULL in PTHREAD_MUTEX_INITIALIZER.
3508	The pthread_mutex_*() routines will try to optimise performance
3509	by choosing either mutexes or critical sections as the basis
3510	for pthread mutexes for each indevidual mutex.
3511	(pthread_mutexattr_t_): Add 'forcecs' element.
3512	Some applications may choose to force use of critical sections
3513	if they know that:-
3514	     the mutex is PROCESS_PRIVATE and,
3515	         either the OS supports TryEnterCriticalSection() or
3516	         pthread_mutex_trylock() will never be called on the mutex.
3517	This attribute will be setable via a non-portable routine.
3518
3519	Note: We don't yet support PROCESS_SHARED mutexes, so the
3520	implementation as it stands will default to Win32 mutexes only if
3521	the OS doesn't support TryEnterCriticalSection. On Win9x, and early
3522	versions of NT 'forcecs' will need to be set in order to get
3523	critical section based mutexes.
3524
3525Sun Jan 17 12:01:26 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3526
3527	* pthread.h (PTHREAD_MUTEX_INITIALIZER): Init new 'staticinit'
3528	value to '1' and existing 'valid' value to '1'.
3529
3530	* global.c (ptw32_mutex_test_init_lock): Add.
3531
3532	* implement.h (ptw32_mutex_test_init_lock.): Add extern.
3533
3534	* private.c (ptw32_processInitialize): Init critical section for
3535	global lock used by _mutex_check_need_init().
3536	(ptw32_processTerminate): Ditto (:s/Init/Destroy/).
3537
3538	* dll.c (dllMain): Move call to FreeLibrary() so that it is only
3539	called once when the process detaches.
3540
3541	* mutex.c (_mutex_check_need_init): New static function to test
3542	and init PTHREAD_MUTEX_INITIALIZER mutexes. Provides serialised
3543	access to the internal state of the uninitialised static mutex.
3544	Called from pthread_mutex_trylock() and pthread_mutex_lock() which
3545	do a quick unguarded test to check if _mutex_check_need_init()
3546	needs to be called. This is safe as the test is conservative
3547 	and is repeated inside the guarded section of
3548	_mutex_check_need_init(). Thus in all calls except the first
3549	calls to lock static mutexes, the additional overhead to lock any
3550	mutex is a single memory fetch and test for zero.
3551
3552	* pthread.h (pthread_mutex_t_): Add 'staticinit' member. Mutexes
3553	initialised by PTHREAD_MUTEX_INITIALIZER aren't really initialised
3554	until the first attempt to lock it. Using the 'valid'
3555	flag (which flags the mutex as destroyed or not) to record this
3556	information would be messy. It is possible for a statically
3557	initialised mutex such as this to be destroyed before ever being
3558	used.
3559
3560	* mutex.c (pthread_mutex_trylock): Call _mutex_check_need_init()
3561	to test/init PTHREAD_MUTEX_INITIALIZER mutexes.
3562	(pthread_mutex_lock): Ditto.
3563	(pthread_mutex_unlock): Add check to ensure we don't try to unlock
3564	an unitialised static mutex.
3565	(pthread_mutex_destroy): Add check to ensure we don't try to delete
3566	a critical section that we never created. Allows us to destroy
3567	a static mutex that has never been locked (and hence initialised).
3568	(pthread_mutex_init): Set 'staticinit' flag to 0 for the new mutex.
3569
3570Sun Jan 17 12:01:26 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3571
3572	* private.c (ptw32_sem_timedwait): Move from semaphore.c.
3573
3574	* semaphore.c : Remove redundant #includes.
3575	(ptw32_sem_timedwait): Move to private.c.
3576	(sem_wait): Add missing abstime arg to pthreadCancelableWait() call.
3577
3578Fri Jan 15 23:38:05 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3579
3580	* condvar.c (cond_timedwait): Remove comment.
3581
3582Fri Jan 15 15:41:28 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
3583
3584	* pthread.h: Add new 'abstime' arg to pthreadCancelableWait()
3585	prototype.
3586
3587	* condvar.c (cond_timedwait): New generalised function called by
3588	both pthread_cond_wait() and pthread_cond_timedwait(). This is
3589	essentially pthread_cond_wait() renamed and modified to add the
3590	'abstime' arg and call the new ptw32_sem_timedwait() instead of
3591	sem_wait().
3592	(pthread_cond_wait): Now just calls the internal static
3593	function cond_timedwait() with an INFINITE wait.
3594	(pthread_cond_timedwait): Now implemented. Calls the internal
3595	static function cond_timedwait().
3596
3597	* implement.h (ptw32_sem_timedwait): New internal function
3598	prototype.
3599
3600	* misc.c (pthreadCancelableWait): Added new 'abstime' argument
3601	to allow shorter than INFINITE wait.
3602
3603	* semaphore.c (ptw32_sem_timedwait): New function for internal
3604	use.  This is essentially sem_wait() modified to add the
3605        'abstime' arg and call the modified (see above)
3606        pthreadCancelableWait().
3607
3608Thu Jan 14 14:27:13 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
3609
3610	* cleanup.c: Correct _cplusplus to __cplusplus wherever used.
3611
3612	* Makefile.in: Add CC=g++ and add -fhandle-exceptions to CFLAGS.
3613	The derived Makefile will compile all units of the package as C++
3614	so that those which include try/catch exception handling should work
3615	properly. The package should compile ok if CC=gcc, however, exception
3616	handling will not be included and thus thread cancellation, for
3617 	example, will not work.
3618
3619	* cleanup.c (ptw32_pop_cleanup): Add #warning to compile this
3620 	file as C++ if using a cygwin32 environment. Perhaps the whole package
3621	should be compiled using g++ under cygwin.
3622
3623	* private.c (ptw32_threadStart): Change #error directive
3624	into #warning and bracket for __CYGWIN__ and derivative compilers.
3625
3626Wed Jan 13 09:34:52 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3627
3628	* build.bat: Delete old binaries before compiling/linking.
3629
3630Tue Jan 12 09:58:38 1999  Tor Lillqvist <tml at iki.fi>
3631
3632	* dll.c: The Microsoft compiler pragmas probably are more
3633	appropriately protected by _MSC_VER than by _WIN32.
3634
3635	* pthread.h: Define ETIMEDOUT. This should be returned by
3636	pthread_cond_timedwait which is not implemented yet as of
3637	snapshot-1999-01-04-1305. It was implemented in the older version.
3638	The Microsoft compiler pragmas probably are more appropriately
3639	protected by _MSC_VER than by _WIN32.
3640
3641	* pthread.def: pthread_mutex_destroy was missing from the def file
3642
3643	* condvar.c (pthread_cond_broadcast): Ensure we only wait on threads
3644	if there were any waiting on the condition.
3645	I think pthread_cond_broadcast should do the WaitForSingleObject
3646	only if cv->waiters > 0? Otherwise it seems to hang, at least in the
3647	testg thread program from glib.
3648
3649Tue Jan 12 09:58:38 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3650
3651	* condvar.c (pthread_cond_timedwait): Fix function description
3652	comments.
3653
3654	* semaphore.c (sem_post): Correct typo in comment.
3655
3656Mon Jan 11 20:33:19 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3657
3658	* pthread.h: Re-arrange conditional compile of pthread_cleanup-*
3659	macros.
3660
3661	* cleanup.c (ptw32_push_cleanup): Provide conditional
3662	compile of cleanup->prev.
3663
36641999-01-11  Tor Lillqvist <tml at iki.fi>
3665
3666	* condvar.c (pthread_cond_init): Invert logic when testing the
3667	return value from calloc().
3668
3669Sat Jan  9 14:32:08 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3670
3671	* implement.h: Compile-time switch for CYGWIN derived environments
3672	to use CreateThread instead of _beginthreadex. Ditto for ExitThread.
3673	Patch provided by Anders Norlander  <anorland at hem2.passagen.se>.
3674
3675Tue Jan  5 16:33:04 1999  Ross Johnson  <rpj at swan.canberra.edu.au>
3676
3677	* cleanup.c (ptw32_pop_cleanup): Add C++ version of __try/__except
3678	block. Move trailing "}" out of #ifdef _WIN32 block left there by
3679	(rpj's) mistake.
3680
3681	* private.c: Remove #include <errno.h> which is included by pthread.h.
3682
36831998-12-11  Ben Elliston  <bje at toilet.to.cygnus.com>
3684
3685	* README: Update info about subscribing to the mailing list.
3686
3687Mon Jan  4 11:23:40 1999  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3688
3689	* all: No code changes, just cleanup.
3690	- remove #if 0 /* Pre Bossom */ enclosed code.
3691	- Remove some redundant #includes.
3692	* pthread.h: Update implemented/unimplemented routines list.
3693	* Tag the bossom merge branch getting ready to merge back to main
3694	trunk.
3695
3696Tue Dec 29 13:11:16 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3697
3698	* implement.h: Move the following struct definitions to pthread.h:
3699	pthread_t_, pthread_attr_t_, pthread_mutex_t_, pthread_mutex_t_,
3700	pthread_mutexattr_t_, pthread_key_t_, pthread_cond_t_,
3701	pthread_condattr_t_, pthread_once_t_.
3702
3703	* pthread.h: Add "_" prefix to pthread_push_cleanup and
3704	pthread_pop_cleanup internal routines, and associated struct and
3705	typedefs.
3706
3707	* buildlib.bat: Add compile command for semaphore.c
3708
3709	* pthread.def: Comment out pthread_atfork routine name.
3710	Now unimplemented.
3711
3712	* tsd.c (pthread_setspecific): Rename tkAssocCreate to
3713	ptw32_tkAssocCreate.
3714	(pthread_key_delete): Rename tkAssocDestroy to
3715	ptw32_tkAssocDestroy.
3716
3717	* sync.c (pthread_join): Rename threadDestroy to ptw32_threadDestroy
3718
3719	* sched.c (is_attr): attr is now **attr (was *attr), so add extra
3720	NULL pointer test.
3721	(pthread_attr_setschedparam): Increase redirection for attr which is
3722	now a **.
3723	(pthread_attr_getschedparam): Ditto.
3724	(pthread_setschedparam): Change thread validation and rename "thread"
3725 	Win32 thread Handle element name to match John Bossom's version.
3726	(pthread_getschedparam): Ditto.
3727
3728	* private.c (ptw32_threadDestroy): Rename call to
3729	callUserDestroyRoutines() as ptw32_callUserDestroyRoutines()
3730
3731	* misc.c: Add #include "implement.h".
3732
3733	* dll.c: Remove defined(KLUDGE) wrapped code.
3734
3735	* fork.c: Remove redefinition of ENOMEM.
3736	Remove pthread_atfork() and fork() with #if 0/#endif.
3737
3738	* create.c (pthread_create): Rename threadStart and threadDestroy calls
3739	to ptw32_threadStart and ptw32_threadDestroy.
3740
3741	* implement.h: Rename "detachedstate" to "detachstate".
3742
3743	* attr.c: Rename "detachedstate" to "detachstate".
3744
3745Mon Dec 28 09:54:39 1998  John Bossom
3746
3747	* semaphore.c: Initial version.
3748	* semaphore.h: Initial version.
3749
3750Mon Dec 28 09:54:39 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3751
3752	* pthread.h (pthread_attr_t_): Change to *pthread_attr_t.
3753
3754Mon Dec 28 09:54:39 1998  John Bossom, Ben Elliston
3755
3756	* attr.c (pthread_attr_setstacksize): Merge with John's version.
3757	(pthread_attr_getstacksize): Merge with John's version.
3758	(pthread_attr_setstackaddr): Merge with John's version.
3759	(pthread_attr_getstackaddr): Merge with John's version.
3760	(pthread_attr_init): Merge with John's version.
3761	(pthread_attr_destroy): Merge with John's version.
3762	(pthread_attr_getdetachstate): Merge with John's version.
3763	(pthread_attr_setdetachstate): Merge with John's version.
3764	(is_attr): attr is now **attr (was *attr), so add extra NULL pointer
3765	test.
3766
3767Mon Dec 28 09:54:39 1998  Ross Johnson
3768
3769	* implement.h (pthread_attr_t_): Add and rename elements in JEB's
3770	version to correspond to original, so that it can be used with
3771	original attr routines.
3772
3773	* pthread.h: Add #endif at end which was truncated in merging.
3774
3775Sun Dec 20 14:51:58 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3776
3777	* misc.c (pthreadCancelableWait): New function by John Bossom. Non-standard
3778	but provides a hook that can be used to implement cancellation points in
3779	applications that use this library.
3780
3781	* pthread.h (pthread_cleanup_pop): C++ (non-WIN32) version uses
3782	try/catch to emulate John Bossom's WIN32 __try/__finally behaviour.
3783	In the WIN32 version __finally block, add a test for AbnormalTermination otherwise
3784	cleanup is only run if the cleanup_pop execute arg is non-zero. Cancellation
3785	should cause the cleanup to run irrespective of the execute arg.
3786
3787	* condvar.c (pthread_condattr_init): Replaced by John Bossom's version.
3788	(pthread_condattr_destroy): Replaced by John Bossom's version.
3789	(pthread_condattr_getpshared): Replaced by John Bossom's version.
3790	(pthread_condattr_setpshared): Replaced by John Bossom's version.
3791	(pthread_cond_init): Replaced by John Bossom's version.
3792	Fix comment (refered to mutex rather than condition variable).
3793	(pthread_cond_destroy): Replaced by John Bossom's version.
3794	(pthread_cond_wait): Replaced by John Bossom's version.
3795	(pthread_cond_timedwait): Replaced by John Bossom's version.
3796	(pthread_cond_signal): Replaced by John Bossom's version.
3797	(pthread_cond_broadcast): Replaced by John Bossom's version.
3798
3799Thu Dec 17 19:10:46 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3800
3801	* tsd.c (pthread_key_create): Replaced by John Bossom's version.
3802	(pthread_key_delete): Replaced by John Bossom's version.
3803	(pthread_setspecific): Replaced by John Bossom's version.
3804	(pthread_getspecific): Replaced by John Bossom's version.
3805
3806Mon Dec  7 09:44:40 1998  John Bossom
3807
3808	* cancel.c (pthread_setcancelstate): Replaced.
3809	(pthread_setcanceltype): Replaced.
3810	(pthread_testcancel): Replaced.
3811	(pthread_cancel): Replaced.
3812
3813	* exit.c (pthread_exit): Replaced.
3814
3815	* misc.c (pthread_self): Replaced.
3816	(pthread_equal): Replaced.
3817
3818	* sync.c (pthread_detach): Replaced.
3819	(pthread_join): Replaced.
3820
3821	* create.c (pthread_create): Replaced.
3822
3823	* private.c (ptw32_processInitialize): New.
3824	(ptw32_processTerminate): New.
3825	(ptw32_threadStart): New.
3826 	(ptw32_threadDestroy): New.
3827	(ptw32_cleanupStack): New.
3828	(ptw32_tkAssocCreate): New.
3829	(ptw32_tkAssocDestroy): New.
3830	(ptw32_callUserDestroyRoutines): New.
3831
3832	* implement.h: Added non-API structures and declarations.
3833
3834	* dll.c (PthreadsEntryPoint): Cast return value of GetProcAddress
3835	to resolve compile warning from MSVC.
3836
3837	* dll.c (DLLmain): Replaced.
3838	* dll.c (PthreadsEntryPoint):
3839	Re-applied Anders Norlander's patch:-
3840	Initialize ptw32_try_enter_critical_section at startup
3841	and release kernel32 handle when DLL is being unloaded.
3842
3843Sun Dec  6 21:54:35 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3844
3845	* buildlib.bat: Fix args to CL when building the .DLL
3846
3847	* cleanup.c (ptw32_destructor_run_all): Fix TSD key management.
3848	This is a tidy-up before TSD and Thread management is completely
3849	replaced by John Bossom's code.
3850
3851	* tsd.c (pthread_key_create): Fix TSD key management.
3852
3853	* global.c (ptw32_key_virgin_next): Initialise.
3854
3855	* build.bat: New DOS script to compile and link a pthreads app
3856	using Microsoft's CL compiler linker.
3857	* buildlib.bat: New DOS script to compile all the object files
3858	and create pthread.lib and pthread.dll using Microsoft's CL
3859	compiler linker.
3860
38611998-12-05  Anders Norlander  <anorland at hem2.passagen.se>
3862
3863	* implement.h (ptw32_try_enter_critical_section): New extern
3864	* dll.c (ptw32_try_enter_critical_section): New pointer to
3865	TryEnterCriticalSection if it exists; otherwise NULL.
3866	* dll.c (PthreadsEntryPoint):
3867	Initialize ptw32_try_enter_critical_section at startup
3868	and release kernel32 handle when DLL is being unloaded.
3869	* mutex.c (pthread_mutex_trylock): Replaced check for NT with
3870	a check if ptw32_try_enter_critical_section is valid
3871	pointer to a function. Call ptw32_try_enter_critical_section
3872	instead of TryEnterCriticalSection to avoid errors on Win95.
3873
3874Thu Dec 3 13:32:00 1998  Ross Johnson  <rpj at ise.canberra.edu.au>
3875
3876	* README: Correct cygwin32 compatibility statement.
3877
3878Sun Nov 15 21:24:06 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3879
3880	* cleanup.c (ptw32_destructor_run_all): Declare missing void * arg.
3881	Fixup CVS merge conflicts.
3882
38831998-10-30  Ben Elliston  <bje at cygnus.com>
3884
3885	* condvar.c (cond_wait): Fix semantic error. Test for equality
3886	instead of making an assignment.
3887
3888Fri Oct 30 15:15:50 1998  Ross Johnson  <rpj at swan.canberra.edu.au>
3889
3890	* cleanup.c (ptw32_handler_push): Fixed bug appending new
3891	handler to list reported by Peter Slacik
3892	<Peter.Slacik at leibinger.freinet.de>.
3893	(new_thread): Rename poorly named local variable to
3894	"new_handler".
3895
3896Sat Oct 24 18:34:59 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3897
3898	* global.c: Add TSD key management array and index declarations.
3899
3900	* implement.h: Ditto for externs.
3901
3902Fri Oct 23 00:08:09 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3903
3904	* implement.h (PTW32_TSD_KEY_REUSE): Add enum.
3905
3906	* private.c (ptw32_delete_thread): Add call to
3907	ptw32_destructor_run_all() to clean up the threads keys.
3908
3909	* cleanup.c (ptw32_destructor_run_all): Check for no more dirty
3910	keys to run destructors on. Assume that the destructor call always
3911	succeeds and set the key value to NULL.
3912
3913Thu Oct 22 21:44:44 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3914
3915	* tsd.c (pthread_setspecific): Add key management code.
3916	(pthread_key_create): Ditto.
3917	(pthread_key_delete): Ditto.
3918
3919	* implement.h (struct ptw32_tsd_key): Add status member.
3920
3921	* tsd.c: Add description of pthread_key_delete() from the
3922	standard as a comment.
3923
3924Fri Oct 16 17:38:47 1998  Ross Johnson  <rpj at swan.canberra.edu.au>
3925
3926	* cleanup.c (ptw32_destructor_run_all): Fix and improve
3927	stepping through the key table.
3928
3929Thu Oct 15 14:05:01 1998  Ross Johnson  <rpj at swan.canberra.edu.au>
3930
3931	* private.c (ptw32_new_thread): Remove init of destructorstack.
3932	No longer an element of pthread_t.
3933
3934	* tsd.c (pthread_setspecific): Fix type declaration and cast.
3935	(pthread_getspecific): Ditto.
3936	(pthread_getspecific): Change error return value to NULL if key
3937	is not in use.
3938
3939Thu Oct 15 11:53:21 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3940
3941	* global.c (ptw32_tsd_key_table): Fix declaration.
3942
3943	* implement.h(ptw32_TSD_keys_TlsIndex): Add missing extern.
3944	(ptw32_tsd_mutex): Ditto.
3945
3946	* create.c (ptw32_start_call): Fix "keys" array declaration.
3947	Add comment.
3948
3949	* tsd.c (pthread_setspecific): Fix type declaration and cast.
3950	(pthread_getspecific): Ditto.
3951
3952	* cleanup.c (ptw32_destructor_run_all): Declare missing loop
3953	counter.
3954
3955Wed Oct 14 21:09:24 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3956
3957	* private.c (ptw32_new_thread): Increment ptw32_threads_count.
3958	(ptw32_delete_thread): Decrement ptw32_threads_count.
3959	Remove some comments.
3960
3961	* exit.c (ptw32_exit): : Fix two pthread_mutex_lock() calls that
3962 	should have been pthread_mutex_unlock() calls.
3963	(ptw32_vacuum): Remove call to ptw32_destructor_pop_all().
3964
3965	* create.c (pthread_create): Fix two pthread_mutex_lock() calls that
3966 	should have been pthread_mutex_unlock() calls.
3967
3968	* global.c (ptw32_tsd_mutex): Add mutex for TSD operations.
3969
3970	* tsd.c (pthread_key_create): Add critical section.
3971	(pthread_setspecific): Ditto.
3972	(pthread_getspecific): Ditto.
3973	(pthread_key_delete): Ditto.
3974
3975	* sync.c (pthread_join): Fix two pthread_mutex_lock() calls that
3976 	should have been pthread_mutex_unlock() calls.
3977
3978Mon Oct 12 00:00:44 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
3979
3980	* implement.h (ptw32_tsd_key_table): New.
3981
3982	* create.c (ptw32_start_call): Initialise per-thread TSD keys
3983	to NULL.
3984
3985	* misc.c (pthread_once): Correct typo in comment.
3986
3987	* implement.h (ptw32_destructor_push): Remove.
3988	(ptw32_destructor_pop): Remove.
3989	(ptw32_destructor_run_all): Rename from ptw32_destructor_pop_all.
3990	(PTW32_TSD_KEY_DELETED): Add enum.
3991	(PTW32_TSD_KEY_INUSE): Add enum.
3992
3993	* cleanup.c (ptw32_destructor_push): Remove.
3994	(ptw32_destructor_pop): Remove.
3995	(ptw32_destructor_run_all): Totally revamped TSD.
3996
3997	* dll.c (ptw32_TSD_keys_TlsIndex): Initialise.
3998
3999	* tsd.c (pthread_setspecific): Totally revamped TSD.
4000	(pthread_getspecific): Ditto.
4001	(pthread_create): Ditto.
4002	(pthread_delete): Ditto.
4003
4004Sun Oct 11 22:44:55 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4005
4006	* global.c (ptw32_tsd_key_table): Add new global.
4007
4008	* implement.h (ptw32_tsd_key_t and struct ptw32_tsd_key):
4009	Add.
4010	(struct _pthread): Remove destructorstack.
4011
4012	* cleanup.c (ptw32_destructor_run_all): Rename from
4013 	ptw32_destructor_pop_all. The key destructor stack was made
4014 	global rather than per-thread. No longer removes destructor nodes
4015	from the stack. Comments updated.
4016
40171998-10-06  Ben Elliston  <bje at cygnus.com>
4018
4019	* condvar.c (cond_wait): Use POSIX, not Win32 mutex calls.
4020	(pthread_cond_broadcast): Likewise.
4021	(pthread_cond_signal): Likewise.
4022
40231998-10-05  Ben Elliston  <bje at cygnus.com>
4024
4025	* pthread.def: Update. Some functions aren't available yet, others
4026	are macros in <pthread.h>.
4027
4028	* tests/join.c: Remove; useless.
4029
4030Mon Oct  5 14:25:08 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4031
4032	* pthread.def: New file for building the DLL.
4033
40341998-10-05  Ben Elliston  <bje at cygnus.com>
4035
4036	* misc.c (pthread_equal): Correct inverted logic bug.
4037	(pthread_once): Use the POSIX mutex primitives, not Win32. Remove
4038	irrelevant FIXME comment.
4039
4040	* global.c (PTHREAD_MUTEX_INITIALIZER): Move to pthread.h.
4041
4042	* pthread.h (PTHREAD_MUTEX_INITIALIZER): Define.
4043	(pthread_mutex_t): Reimplement as a struct containing a valid
4044	flag. If the flag is ever down upon entry to a mutex operation,
4045	we call pthread_mutex_create() to initialise the object. This
4046	fixes the problem of how to handle statically initialised objects
4047	that can't call InitializeCriticalSection() due to their context.
4048	(PTHREAD_ONCE_INIT): Define.
4049
4050	* mutex.c (pthread_mutex_init): Set valid flag.
4051	(pthread_mutex_destroy): Clear valid flag.
4052	(pthread_mutex_lock): Check and handle the valid flag.
4053	(pthread_mutex_unlock): Likewise.
4054	(pthread_mutex_trylock): Likewise.
4055
4056	* tests/mutex3.c: New file; test for the static initialisation
4057	macro. Passes.
4058
4059	* tests/create1.c: New file; test pthread_create(). Passes.
4060
4061	* tests/equal.c: Poor test; remove.
4062
4063	* tests/equal1.c New file; test pthread_equal(). Passes.
4064
4065	* tests/once1.c: New file; test for pthread_once(). Passes.
4066
4067	* tests/self.c: Remove; rename to self1.c.
4068
4069	* tests/self1.c: This is the old self.c.
4070
4071	* tests/self2.c: New file. Test pthread_self() with a single
4072	thread. Passes.
4073
4074	* tests/self3.c: New file. Test pthread_self() with a couple of
4075	threads to ensure their thread IDs differ. Passes.
4076
40771998-10-04  Ben Elliston  <bje at cygnus.com>
4078
4079	* tests/mutex2.c: Test pthread_mutex_trylock(). Passes.
4080
4081	* tests/mutex1.c: New basic test for mutex functions (it passes).
4082	(main): Eliminate warning.
4083
4084	* configure.in: Test for __stdcall, not _stdcall. Typo.
4085
4086	* configure: Regenerate.
4087
4088	* attr.c (pthread_attr_setstackaddr): Remove FIXME comment. Win32
4089	does know about ENOSYS after all.
4090	(pthread_attr_setstackaddr): Likewise.
4091
40921998-10-03  Ben Elliston  <bje at cygnus.com>
4093
4094	* configure.in: Test for the `_stdcall' keyword.  Define `STDCALL'
4095	to `_stdcall' if we have it, null otherwise.
4096
4097	* configure: Regenerate.
4098
4099	* acconfig.h (STDCALL): New define.
4100
4101	* config.h.in: Regenerate.
4102
4103	* create.c (ptw32_start_call): Add STDCALL prefix.
4104
4105	* mutex.c (pthread_mutex_init): Correct function signature.
4106
4107	* attr.c (pthread_attr_init): Only zero out the `sigmask' member
4108	if we have the sigset_t type.
4109
4110	* pthread.h: No need to include <unistd.h>.  It doesn't even exist
4111	on Win32! Again, an artifact of cross-compilation.
4112	(pthread_sigmask): Only provide if we have the sigset_t type.
4113
4114	* process.h: Remove. This was a stand-in before we started doing
4115	native compilation under Win32.
4116
4117	* pthread.h (pthread_mutex_init): Make `attr' argument const.
4118
41191998-10-02  Ben Elliston  <bje at cygnus.com>
4120
4121	* COPYING: Remove.
4122
4123	* COPYING.LIB: Add. This library is under the LGPL.
4124
41251998-09-13  Ben Elliston  <bje at cygnus.com>
4126
4127	* configure.in: Test for required system features.
4128
4129	* configure: Generate.
4130
4131	* acconfig.h: New file.
4132
4133	* config.h.in: Generate.
4134
4135	* Makefile.in: Renamed from Makefile.
4136
4137	* COPYING: Import from a recent GNU package.
4138
4139	* config.guess: Likewise.
4140
4141	* config.sub: Likewise.
4142
4143	* install-sh: Likewise.
4144
4145	* config.h: Remove.
4146
4147	* Makefile: Likewise.
4148
41491998-09-12  Ben Elliston  <bje at cygnus.com>
4150
4151	* windows.h: No longer needed; remove.
4152
4153	* windows.c: Likewise.
4154
4155Sat Sep 12 20:09:24 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4156
4157	* windows.h: Remove error number definitions. These are in <errno.h>
4158
4159	* tsd.c: Add comment explaining rationale for not building
4160	POSIX TSD on top of Win32 TLS.
4161
41621998-09-12  Ben Elliston  <bje at cygnus.com>
4163
4164	* {most}.c: Include <errno.h> to get POSIX error values.
4165
4166	* signal.c (pthread_sigmask): Only provide if HAVE_SIGSET_T is
4167	defined.
4168
4169	* config.h: #undef features, don't #define them.  This will be
4170	generated by autoconf very soon.
4171
41721998-08-11  Ben Elliston  <bje at cygnus.com>
4173
4174	* Makefile (LIB): Define.
4175	(clean): Define target.
4176	(all): Build a library not just the object files.
4177
4178	* pthread.h: Provide a definition for struct timespec if we don't
4179	already have one.
4180
4181	* windows.c (TlsGetValue): Bug fix.
4182
4183Thu Aug  6 15:19:22 1998  Ross Johnson  <rpj at swan.canberra.edu.au>
4184
4185	* misc.c (pthread_once): Fix arg 1 of EnterCriticalSection()
4186 	and LeaveCriticalSection() calls to pass address-of lock.
4187
4188	* fork.c (pthread_atfork): Typecast (void (*)(void *)) funcptr
4189	in each ptw32_handler_push() call.
4190
4191	* exit.c (ptw32_exit): Fix attr arg in
4192	pthread_attr_getdetachstate() call.
4193
4194	* private.c (ptw32_new_thread): Typecast (HANDLE) NULL.
4195	(ptw32_delete_thread): Ditto.
4196
4197	* implement.h: (PTW32_MAX_THREADS): Add define. This keeps
4198	changing in an attempt to make thread administration data types
4199	opaque and cleanup DLL startup.
4200
4201	* dll.c (PthreadsEntryPoint):
4202	(ptw32_virgins): Remove malloc() and free() calls.
4203	(ptw32_reuse): Ditto.
4204	(ptw32_win32handle_map): Ditto.
4205	(ptw32_threads_mutex_table): Ditto.
4206
4207	* global.c (_POSIX_THREAD_THREADS_MAX): Initialise with
4208	PTW32_MAX_THREADS.
4209	(ptw32_virgins): Ditto.
4210	(ptw32_reuse): Ditto.
4211	(ptw32_win32handle_map): Ditto.
4212	(ptw32_threads_mutex_table): Ditto.
4213
4214	* create.c (pthread_create): Typecast (HANDLE) NULL.
4215	Typecast (unsigned (*)(void *)) start_routine.
4216
4217	* condvar.c (pthread_cond_init): Add address-of operator & to
4218	arg 1 of pthread_mutex_init() call.
4219	(pthread_cond_destroy): Add address-of operator & to
4220	arg 1 of pthread_mutex_destroy() call.
4221
4222	* cleanup.c (ptw32_destructor_pop_all): Add (int) cast to
4223	pthread_getspecific() arg.
4224	(ptw32_destructor_pop): Add (void *) cast to "if" conditional.
4225	(ptw32_destructor_push): Add (void *) cast to
4226	ptw32_handler_push() "key" arg.
4227	(malloc.h): Add include.
4228
4229	* implement.h (ptw32_destructor_pop): Add prototype.
4230
4231	* tsd.c (implement.h): Add include.
4232
4233	* sync.c (pthread_join): Remove target_thread_mutex and it's
4234	initialisation. Rename getdetachedstate to getdetachstate.
4235	Remove unused variable "exitcode".
4236	(pthread_detach): Remove target_thread_mutex and it's
4237	initialisation. Rename getdetachedstate to getdetachstate.
4238	Rename setdetachedstate to setdetachstate.
4239
4240	* signal.c (pthread_sigmask): Rename SIG_SET to SIG_SETMASK.
4241	Cast "set" to (long *) in assignment to passify compiler warning.
4242	Add address-of operator & to thread->attr.sigmask in memcpy() call
4243	and assignment.
4244	(pthread_sigmask): Add address-of operator & to thread->attr.sigmask
4245	in memcpy() call and assignment.
4246
4247	* windows.h (THREAD_PRIORITY_ERROR_RETURN): Add.
4248	(THREAD_PRIORITY_LOWEST): Add.
4249	(THREAD_PRIORITY_HIGHEST): Add.
4250
4251	* sched.c (is_attr): Add function.
4252	(implement.h): Add include.
4253	(pthread_setschedparam): Rename all instances of "sched_policy"
4254	to "sched_priority".
4255	(pthread_getschedparam): Ditto.
4256
4257Tue Aug  4 16:57:58 1998  Ross Johnson  <rpj at swan.canberra.edu.au>
4258
4259	* private.c (ptw32_delete_thread): Fix typo. Add missing ';'.
4260
4261	* global.c (ptw32_virgins): Change types from pointer to
4262	array pointer.
4263	(ptw32_reuse): Ditto.
4264	(ptw32_win32handle_map): Ditto.
4265	(ptw32_threads_mutex_table): Ditto.
4266
4267	* implement.h(ptw32_virgins): Change types from pointer to
4268	array pointer.
4269	(ptw32_reuse): Ditto.
4270	(ptw32_win32handle_map): Ditto.
4271	(ptw32_threads_mutex_table): Ditto.
4272
4273	* private.c (ptw32_delete_thread): Fix "entry" should be "thread".
4274
4275	* misc.c (pthread_self): Add extern for ptw32_threadID_TlsIndex.
4276
4277	* global.c: Add comment.
4278
4279	* misc.c (pthread_once): Fix member -> dereferences.
4280	Change ptw32_once_flag to once_control->flag in "if" test.
4281
4282Tue Aug  4 00:09:30 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4283
4284	* implement.h(ptw32_virgins): Add extern.
4285	(ptw32_virgin_next): Ditto.
4286	(ptw32_reuse): Ditto.
4287	(ptw32_reuse_top): Ditto.
4288	(ptw32_win32handle_map): Ditto.
4289	(ptw32_threads_mutex_table): Ditto.
4290
4291	* global.c (ptw32_virgins): Changed from array to pointer.
4292	Storage allocation for the array moved into dll.c.
4293	(ptw32_reuse): Ditto.
4294	(ptw32_win32handle_map): Ditto.
4295	(ptw32_threads_mutex_table): Ditto.
4296
4297	* dll.c (PthreadsEntryPoint): Set up thread admin storage when
4298	DLL is loaded.
4299
4300	* fork.c (pthread_atfork): Fix function pointer arg to all
4301	ptw32_handler_push() calls. Change "arg" arg to NULL in child push.
4302
4303	* exit.c: Add windows.h and process.h includes.
4304	(ptw32_exit): Add local detachstate declaration.
4305	(ptw32_exit): Fix incorrect name for pthread_attr_getdetachstate().
4306
4307	* pthread.h (_POSIX_THREAD_ATTR_STACKSIZE): Move from global.c
4308	(_POSIX_THREAD_ATTR_STACKADDR): Ditto.
4309
4310	* create.c (pthread_create): Fix #if should be #ifdef.
4311	(ptw32_start_call): Remove usused variables.
4312
4313	* process.h: Create.
4314
4315	* windows.h: Move _beginthreadex and _endthreadex into
4316	process.h
4317
4318Mon Aug  3 21:19:57 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4319
4320	* condvar.c (pthread_cond_init): Add NULL attr to
4321	pthread_mutex_init() call - default attributes will be used.
4322	(cond_wait): Fix typo.
4323	(cond_wait): Fix typo - cv was ev.
4324	(pthread_cond_broadcast): Fix two identical typos.
4325
4326	* cleanup.c (ptw32_destructor_pop_all): Remove _ prefix from
4327	PTHREAD_DESTRUCTOR_ITERATIONS.
4328
4329	* pthread.h: Move _POSIX_* values into posix.h
4330
4331	* pthread.h: Fix typo in pthread_mutex_init() prototype.
4332
4333	* attr.c (pthread_attr_init): Fix error in priority member init.
4334
4335	* windows.h (THREAD_PRIORITY_NORMAL): Add.
4336
4337	* pthread.h (sched_param): Add missing ';' to struct definition.
4338
4339	* attr.c (pthread_attr_init): Remove obsolete pthread_attr_t
4340	member initialisation - cancelstate, canceltype, cancel_pending.
4341	(is_attr): Make arg "attr" a const.
4342
4343	* implement.h (PTW32_HANDLER_POP_LIFO): Remove definition.
4344	(PTW32_HANDLER_POP_FIFO): Ditto.
4345	(PTW32_VALID): Add missing newline escape (\).
4346	(ptw32_handler_node): Make element "next" a pointer.
4347
43481998-08-02  Ben Elliston  <bje at cygnus.com>
4349
4350	* windows.h: Remove duplicate TlsSetValue() prototype.  Add
4351	TlsGetValue() prototype.
4352	(FALSE): Define.
4353	(TRUE): Likewise.
4354	Add forgotten errno values.  Guard against multiple #includes.
4355
4356	* windows.c: New file.  Implement stubs for Win32 functions.
4357
4358	* Makefile (SRCS): Remove.  Not explicitly needed.
4359	(CFLAGS): Add -Wall for all warnings with GCC.
4360
4361Sun Aug  2 19:03:42 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4362
4363	* config.h: Create. This is a temporary stand-in for autoconf yet
4364	to be done.
4365 	(HAVE_SIGNAL_H): Add.
4366
4367	* pthread.h: Minor rearrangement for temporary config.h.
4368
4369Fri Jul 31 14:00:29 1998  Ross Johnson  <rpj at swan.canberra.edu.au>
4370
4371	* cleanup.c (ptw32_destructor_pop): Implement. Removes
4372	destructors associated with a key without executing them.
4373	(ptw32_destructor_pop_all): Add FIXME comment.
4374
4375	* tsd.c (pthread_key_delete): Add call to ptw32_destructor_pop().
4376
4377Fri Jul 31 00:05:45 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4378
4379	* tsd.c (pthread_key_create): Update to properly associate
4380	the destructor routine with the key.
4381	(pthread_key_delete): Add FIXME comment.
4382
4383	* exit.c (ptw32_vacuum): Add call to
4384	ptw32_destructor_pop_all().
4385
4386	* implement.h (ptw32_handler_pop_all): Add prototype.
4387	(ptw32_destructor_pop_all): Ditto.
4388
4389	* cleanup.c (ptw32_destructor_push): Implement. This is just a
4390	call to ptw32_handler_push().
4391	(ptw32_destructor_pop_all): Implement. This is significantly
4392	different to ptw32_handler_pop_all().
4393
4394	* Makefile (SRCS): Create. Preliminary.
4395
4396	* windows.h: Create. Contains Win32 definitions for compile
4397	testing. This is just a standin for the real one.
4398
4399	* pthread.h (SIG_UNBLOCK): Fix typo. Was SIG_BLOCK.
4400	(windows.h): Add include. Required for CRITICAL_SECTION.
4401	(pthread_cond_t): Move enum declaration outside of struct
4402	definition.
4403	(unistd.h): Add include - may be temporary.
4404
4405	* condvar.c (windows.h): Add include.
4406
4407	* implement.h (PTW32_THIS): Remove - no longer required.
4408	(PTW32_STACK): Use pthread_self() instead of PTW32_THIS.
4409
4410Thu Jul 30 23:12:45 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4411
4412	* implement.h: Remove ptw32_find_entry() prototype.
4413
4414	* private.c: Extend comments.
4415	Remove ptw32_find_entry() - no longer needed.
4416
4417	* create.c (ptw32_start_call): Add call to TlsSetValue() to
4418	store the thread ID.
4419
4420	* dll.c (PthreadsEntryPoint): Implement. This is called
4421	whenever a process loads the DLL. Used to initialise thread
4422	local storage.
4423
4424	* implement.h: Add ptw32_threadID_TlsIndex.
4425	Add ()s around PTW32_VALID expression.
4426
4427	* misc.c (pthread_self): Re-implement using Win32 TLS to store
4428	the threads own ID.
4429
4430Wed Jul 29 11:39:03 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4431
4432	* private.c: Corrections in comments.
4433	(ptw32_new_thread): Alter "if" flow to be more natural.
4434
4435	* cleanup.c (ptw32_handler_push): Same as below.
4436
4437	* create.c (pthread_create): Same as below.
4438
4439	* private.c (ptw32_new_thread): Rename "new" to "new_thread".
4440	Since when has a C programmer been required to know C++?
4441
4442Tue Jul 28 14:04:29 1998  Ross Johnson  <rpj at swan.canberra.edu.au>
4443
4444	* implement.h: Add PTW32_VALID macro.
4445
4446	* sync.c (pthread_join): Modify to use the new thread
4447	type and ptw32_delete_thread(). Rename "target" to "thread".
4448	Remove extra local variable "target".
4449	(pthread_detach): Ditto.
4450
4451	* signal.c (pthread_sigmask): Move init of "us" out of inner block.
4452	Fix instance of "this" should have been "us". Rename "us" to "thread".
4453
4454	* sched.c (pthread_setschedparam): Modify to use the new thread
4455	type.
4456	(pthread_getschedparam): Ditto.
4457
4458	* private.c (ptw32_find_thread): Fix return type and arg.
4459
4460	* implement.h: Remove PTW32_YES and PTW32_NO.
4461	(ptw32_new_thread): Add prototype.
4462	(ptw32_find_thread): Ditto.
4463	(ptw32_delete_thread): Ditto.
4464	(ptw32_new_thread_entry): Remove prototype.
4465	(ptw32_find_thread_entry): Ditto.
4466	(ptw32_delete_thread_entry): Ditto.
4467	(  PTW32_NEW, PTW32_INUSE, PTW32_EXITED, PTW32_REUSE):
4468	Add.
4469
4470
4471	* create.c (pthread_create): Minor rename "us" to "new" (I need
4472	these cues but it doesn't stop me coming out with some major bugs
4473	at times).
4474	Load start_routine and arg into the thread so the wrapper can
4475	call it.
4476
4477	* exit.c (pthread_exit): Fix pthread_this should be pthread_self.
4478
4479	* cancel.c (pthread_setcancelstate): Change
4480 	ptw32_threads_thread_t * to pthread_t and init with
4481 	pthread_this().
4482	(pthread_setcanceltype): Ditto.
4483
4484	* exit.c (ptw32_exit): Add new pthread_t arg.
4485	Rename ptw32_delete_thread_entry to ptw32_delete_thread.
4486	Rename "us" to "thread".
4487	(pthread_exit): Call ptw32_exit with added thread arg.
4488
4489	* create.c (ptw32_start_call): Insert missing ")".
4490	Add "us" arg to ptw32_exit() call.
4491	(pthread_create): Modify to use new thread allocation scheme.
4492
4493	* private.c: Added detailed explanation of the new thread
4494	allocation scheme.
4495	(ptw32_new_thread): Totally rewritten to use
4496	new thread allocation scheme.
4497	(ptw32_delete_thread): Ditto.
4498	(ptw32_find_thread): Obsolete.
4499
4500Mon Jul 27 17:46:37 1998  Ross Johnson  <rpj at swan.canberra.edu.au>
4501
4502	* create.c (pthread_create): Start of rewrite. Not completed yet.
4503
4504	* private.c (ptw32_new_thread_entry): Start of rewrite. Not
4505	complete.
4506
4507	* implement.h (ptw32_threads_thread): Rename, remove thread
4508	member, add win32handle and ptstatus members.
4509	(ptw32_t): Add.
4510
4511	* pthread.h: pthread_t is no longer mapped directly to a Win32
4512	HANDLE type. This is so we can let the Win32 thread terminate and
4513	reuse the HANDLE while pthreads holds it's own thread ID until
4514	the last waiting join exits.
4515
4516Mon Jul 27 00:20:37 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4517
4518	* private.c (ptw32_delete_thread_entry): Destroy the thread
4519 	entry attribute object before deleting the thread entry itself.
4520
4521	* attr.c (pthread_attr_init): Initialise cancel_pending = FALSE.
4522	(pthread_attr_setdetachstate): Rename "detached" to "detachedstate".
4523	(pthread_attr_getdetachstate): Ditto.
4524
4525	* exit.c (ptw32_exit): Fix incorrect check for detachedstate.
4526
4527	* implement.h (ptw32_call_t): Remove env member.
4528
4529Sun Jul 26 13:06:12 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4530
4531	* implement.h (ptw32_new_thread_entry): Fix prototype.
4532	(ptw32_find_thread_entry): Ditto.
4533	(ptw32_delete_thread_entry): Ditto.
4534	(ptw32_exit): Add prototype.
4535
4536	* exit.c (ptw32_exit): New function. Called from pthread_exit()
4537	and ptw32_start_call() to exit the thread. It allows an extra
4538	argument which is the return code passed to _endthreadex().
4539	(ptw32_exit): Move thread entry delete call from ptw32_vacuum()
4540	into here. Add more explanation of thread entry deletion.
4541	(ptw32_exit): Clarify comment.
4542
4543	* create.c (ptw32_start_call): Change pthread_exit() call to
4544	ptw32_exit() call.
4545
4546	* exit.c (ptw32_vacuum): Add thread entry deletion code
4547	moved from ptw32_start_call(). See next item.
4548	(pthread_exit): Remove longjmp(). Add mutex lock around thread table
4549	manipulation code. This routine now calls _enthreadex().
4550
4551	* create.c (ptw32_start_call): Remove setjmp() call and move
4552	cleanup code out. Call pthread_exit(NULL) to terminate the thread.
4553
45541998-07-26  Ben Elliston  <bje at cygnus.com>
4555
4556	* tsd.c (pthread_getspecific): Update comments.
4557
4558	* mutex.c (pthread_mutexattr_setpshared): Not supported; remove.
4559	(pthread_mutexattr_getpshared): Likewise.
4560
4561	* pthread.h (pthread_mutexattr_setpshared): Remove prototype.
4562	(pthread_mutexattr_getpshared): Likewise.
4563
4564Sun Jul 26 00:09:59 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4565
4566	* sync.c: Rename all instances of ptw32_count_mutex to
4567	ptw32_table_mutex.
4568
4569	* implement.h: Rename ptw32_count_mutex to
4570	ptw32_table_mutex.
4571
4572	* global.c: Rename ptw32_count_mutex to
4573	ptw32_table_mutex.
4574
4575	* create.c (pthread_create): Add critical sections.
4576	(ptw32_start_call): Rename ptw32_count_mutex to
4577	ptw32_table_mutex.
4578
4579	* cancel.c (pthread_setcancelstate): Fix indirection bug and rename
4580	"this" to "us".
4581
4582	* signal.c (pthread_sigmask): Rename "this" to "us" and fix some
4583	minor syntax errors. Declare "us" and initialise it.
4584
4585	* sync.c (pthread_detach): Rename "this" to "target".
4586
4587	* pthread.h: Converting PTHREAD_* defines to alias the (const int)
4588	values in global.c.
4589
4590	* global.c: Started converting PTHREAD_* defines to (const int) as
4591 	a part of making the eventual pthreads DLL binary compatible
4592 	through version changes.
4593
4594	* condvar.c (cond_wait): Add cancelation point. This applies the
4595	point to both pthread_cond_wait() and pthread_cond_timedwait().
4596
4597	* exit.c (pthread_exit): Rename "this" to "us".
4598
4599	* implement.h: Add comment.
4600
4601	* sync.c (pthread_join): I've satisfied myself that pthread_detach()
4602	does set the detached attribute in the thread entry attributes
4603	to PTHREAD_CREATE_DETACHED. "if" conditions were changed to test
4604	that attribute instead of a separate flag.
4605
4606	* create.c (pthread_create): Rename "this" to "us".
4607	(pthread_create): cancelstate and canceltype are not attributes
4608	so the copy to thread entry attribute storage was removed.
4609	Only the thread itself can change it's cancelstate or canceltype,
4610	ie. the thread must exist already.
4611
4612	* private.c (ptw32_delete_thread_entry): Mutex locks removed.
4613	Mutexes must be applied at the caller level.
4614	(ptw32_new_thread_entry): Ditto.
4615	(ptw32_new_thread_entry): Init cancelstate, canceltype, and
4616	cancel_pending to default values.
4617	(ptw32_new_thread_entry): Rename "this" to "new".
4618	(ptw32_find_thread_entry): Rename "this" to "entry".
4619	(ptw32_delete_thread_entry): Rename "thread_entry" to "entry".
4620
4621	* create.c (ptw32_start_call): Mutexes changed to
4622	ptw32_count_mutex. All access to the threads table entries is
4623	under the one mutex. Otherwise chaos reigns.
4624
4625Sat Jul 25 23:16:51 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4626
4627	* implement.h (ptw32_threads_thread): Move cancelstate and
4628 	canceltype members out of pthread_attr_t into here.
4629
4630	* fork.c (fork): Add comment.
4631
46321998-07-25  Ben Elliston  <bje at cygnus.com>
4633
4634	* fork.c (fork): Autoconfiscate.
4635
4636Sat Jul 25 00:00:13 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4637
4638	* create.c (ptw32_start_call): Set thread priority.  Ensure our
4639 	thread entry is removed from the thread table but only if
4640 	pthread_detach() was called and there are no waiting joins.
4641	(pthread_create): Set detach flag in thread entry if the
4642	thread is created PTHREAD_CREATE_DETACHED.
4643
4644	* pthread.h (pthread_attr_t): Rename member "detachedstate".
4645
4646	* attr.c (pthread_attr_init): Rename attr members.
4647
4648	* exit.c (pthread_exit): Fix indirection mistake.
4649
4650	* implement.h (PTW32_THREADS_TABLE_INDEX): Add.
4651
4652	* exit.c (ptw32_vacuum): Fix incorrect args to
4653	ptw32_handler_pop_all() calls.
4654	Make thread entry removal conditional.
4655
4656	* sync.c (pthread_join): Add multiple join and async detach handling.
4657
4658	* implement.h (PTW32_THREADS_TABLE_INDEX): Add.
4659
4660	* global.c (ptw32_threads_mutex_table): Add.
4661
4662	* implement.h (ptw32_once_flag): Remove.
4663	(ptw32_once_lock): Ditto.
4664	(ptw32_threads_mutex_table): Add.
4665
4666	* global.c (ptw32_once_flag): Remove.
4667	(ptw32_once_lock): Ditto.
4668
4669	* sync.c (pthread_join): Fix tests involving new return value
4670	from ptw32_find_thread_entry().
4671	(pthread_detach): Ditto.
4672
4673	* private.c (ptw32_find_thread_entry): Failure return code
4674	changed from -1 to NULL.
4675
4676Fri Jul 24 23:09:33 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4677
4678	* create.c (pthread_create): Change . to -> in sigmask memcpy() args.
4679
4680	* pthread.h: (pthread_cancel): Add function prototype.
4681	(pthread_testcancel): Ditto.
4682
46831998-07-24  Ben Elliston  <bje at cygnus.com>
4684
4685	* pthread.h (pthread_condattr_t): Rename dummy structure member.
4686	(pthread_mutexattr_t): Likewise.
4687
4688Fri Jul 24 21:13:55 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4689
4690	* cancel.c (pthread_cancel): Implement.
4691	(pthread_testcancel): Implement.
4692
4693	* exit.c (pthread_exit): Add comment explaining the longjmp().
4694
4695	* implement.h (ptw32_threads_thread_t): New member cancelthread.
4696	(PTW32_YES): Define.
4697	(PTW32_NO): Define.
4698	(RND_SIZEOF): Remove.
4699
4700	* create.c (pthread_create): Rename cancelability to cancelstate.
4701
4702	* pthread.h (pthread_attr_t): Rename cancelability to cancelstate.
4703	(PTHREAD_CANCELED): Define.
4704
47051998-07-24  Ben Elliston  <bje at cygnus.com>
4706
4707	* pthread.h (SIG_BLOCK): Define if not already defined.
4708	(SIG_UNBLOCK): Likewise.
4709	(SIG_SETMASK): Likewise.
4710	(pthread_attr_t): Add signal mask member.
4711	(pthread_sigmask): Add function prototype.
4712
4713	* signal.c (pthread_sigmask): Implement.
4714
4715	* create.c: #include <string.h> to get a prototype for memcpy().
4716	(pthread_create): New threads inherit their creator's signal
4717	mask.  Copy the signal mask to the new thread structure if we know
4718	about signals.
4719
4720Fri Jul 24 16:33:17 1998  Ross Johnson  <rpj at swan.canberra.edu.au>
4721
4722	* fork.c (pthread_atfork): Add all the necessary push calls.
4723	Local implementation semantics:
4724	If we get an ENOMEM at any time then ALL handlers
4725	(including those from previous pthread_atfork() calls) will be
4726	popped off each of the three atfork stacks before we return.
4727	(fork): Add all the necessary pop calls. Add the thread cancellation
4728	and join calls to the child fork.
4729	Add #includes.
4730
4731	* implement.h: (ptw32_handler_push): Fix return type and stack arg
4732	type in prototype.
4733	(ptw32_handler_pop): Fix stack arg type in prototype.
4734	(ptw32_handler_pop_all): Fix stack arg type in prototype.
4735
4736	* cleanup.c (ptw32_handler_push): Change return type to int and
4737	return ENOMEM if malloc() fails.
4738
4739	* sync.c (pthread_detach): Use equality test, not assignment.
4740
4741	* create.c (ptw32_start_call): Add call to Win32 CloseHandle()
4742	if thread is detached.
4743
47441998-07-24  Ben Elliston  <bje at cygnus.com>
4745
4746	* sync.c (pthread_detach): Close the Win32 thread handle to
4747	emulate detached (or daemon) threads.
4748
4749Fri Jul 24 03:00:25 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4750
4751	* sync.c (pthread_join): Save valueptr arg in joinvalueptr for
4752	pthread_exit() to use.
4753
4754	* private.c (ptw32_new_thread_entry): Initialise joinvalueptr to
4755	NULL.
4756
4757	* create.c (ptw32_start_call): Rewrite to facilitate joins.
4758	pthread_exit() will do a longjmp() back to here. Does appropriate
4759	cleanup and exit/return from the thread.
4760	(pthread_create): _beginthreadex() now passes a pointer to our
4761	thread table entry instead of just the call member of that entry.
4762
4763	* implement.h (ptw32_threads_thread): New member
4764	void ** joinvalueptr.
4765	(ptw32_call_t): New member jmpbuf env.
4766
4767	* exit.c (pthread_exit): Major rewrite to handle joins and handing
4768	value pointer to joining thread. Uses longjmp() back to
4769	ptw32_start_call().
4770
4771	* create.c (pthread_create): Ensure values of new attribute members
4772	are copied to the thread attribute object.
4773
4774	* attr.c (pthread_attr_destroy):  Fix merge conflicts.
4775	(pthread_attr_getdetachstate):  Fix merge conflicts.
4776	(pthread_attr_setdetachstate):  Fix merge conflicts.
4777
4778	* pthread.h:  Fix merge conflicts.
4779
4780	* sync.c (pthread_join): Fix merge conflicts.
4781
4782Fri Jul 24 00:21:21 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4783
4784	* sync.c (pthread_join): Add check for valid and joinable
4785	thread.
4786	(pthread_detach): Implement. After checking for a valid and joinable
4787	thread, it's still a no-op.
4788
4789	* private.c (ptw32_find_thread_entry): Bug prevented returning
4790	an error value in some cases.
4791
4792	* attr.c (pthread_attr_setdetachedstate): Implement.
4793	(pthread_attr_getdetachedstate): Implement.
4794
4795	* implement.h: Move more hidden definitions into here from
4796	pthread.h.
4797
47981998-07-24  Ben Elliston  <bje at cygnus.com>
4799
4800	* pthread.h (PTHREAD_CREATE_JOINABLE): Define.
4801	(PTHREAD_CREATE_DETACHED): Likewise.
4802	(pthread_attr_t): Add new structure member `detached'.
4803	(pthread_attr_getdetachstate): Add function prototype.
4804	(pthread_attr_setdetachstate): Likewise.
4805
4806	* sync.c (pthread_join): Return if the target thread is detached.
4807
4808	* attr.c (pthread_attr_init): Initialise cancelability and
4809	canceltype structure members.
4810	(pthread_attr_getdetachstate): Implement.
4811	(pthread_attr_setdetachstate): Likewise.
4812
4813	* implement.h (PTW32_CANCEL_DEFAULTS): Remove.  Bit fields
4814	proved to be too cumbersome.  Set the defaults in attr.c using the
4815	public PTHREAD_CANCEL_* constants.
4816
4817	* cancel.c: New file.
4818
4819	* pthread.h (sched_param): Define this type.
4820	(pthread_attr_getschedparam): Add function prototype.
4821	(pthread_attr_setschedparam): Likewise.
4822	(pthread_setcancelstate): Likewise.
4823	(pthread_setcanceltype): Likewise.
4824	(sched_get_priority_min): Likewise.
4825	(sched_get_priority_max): Likewise.
4826	(pthread_mutexattr_setprotocol): Remove; not supported.
4827	(pthread_mutexattr_getprotocol): Likewise.
4828	(pthread_mutexattr_setprioceiling): Likewise.
4829	(pthread_mutexattr_getprioceiling): Likewise.
4830	(pthread_attr_t): Add canceltype member.  Update comments.
4831	(SCHED_OTHER): Define this scheduling policy constant.
4832	(SCHED_FIFO): Likewise.
4833	(SCHED_RR): Likewise.
4834	(SCHED_MIN): Define the lowest possible value for this constant.
4835	(SCHED_MAX): Likewise, the maximum possible value.
4836	(PTHREAD_CANCEL_ASYNCHRONOUS): Redefine.
4837	(PTHREAD_CANCEL_DEFERRED): Likewise.
4838
4839	* sched.c: New file.
4840	(pthread_setschedparam): Implement.
4841	(pthread_getschedparam): Implement.
4842	(sched_get_priority_max): Validate policy argument.
4843	(sched_get_priority_min): Likewise.
4844
4845	* mutex.c (pthread_mutexattr_setprotocol): Remove; not supported.
4846	(pthread_mutexattr_getprotocol): Likewise.
4847	(pthread_mutexattr_setprioceiling): Likewise.
4848	(pthread_mutexattr_getprioceiling): Likewise.
4849
4850Fri Jul 24 00:21:21 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4851
4852	* create.c (pthread_create): Arg to ptw32_new_thread_entry()
4853	changed. See next entry. Move mutex locks out. Changes made yesterday
4854	and today allow us to start the new thread running rather than
4855	temporarily suspended.
4856
4857	* private.c (ptw32_new_thread_entry): ptw32_thread_table
4858	was changed back to a table of thread structures rather than pointers.
4859	As such we're trading storage for increaded speed. This routine
4860	was modified to work with the new table. Mutex lock put in around
4861	global data accesses.
4862	(ptw32_find_thread_entry): Ditto
4863	(ptw32_delete_thread_entry): Ditto
4864
4865Thu Jul 23 23:25:30 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4866
4867	* global.c: New. Global data objects declared here. These moved from
4868	pthread.h.
4869
4870	* pthread.h: Move implementation hidden definitions into
4871	implement.h.
4872
4873	* implement.h: Move implementation hidden definitions from
4874	pthread.h. Add constants to index into the different handler stacks.
4875
4876	* cleanup.c (ptw32_handler_push): Simplify args. Restructure.
4877	(ptw32_handler_pop): Simplify args. Restructure.
4878	(ptw32_handler_pop_all): Simplify args. Restructure.
4879
4880Wed Jul 22 00:16:22 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4881
4882	* attr.c, implement.h, pthread.h, ChangeLog: Resolve CVS merge
4883	conflicts.
4884
4885	* private.c (ptw32_find_thread_entry): Changes to return type
4886	to support leaner ptw32_threads_table[] which now only stores
4887	ptw32_thread_thread_t *.
4888	(ptw32_new_thread_entry): Internal changes.
4889	(ptw32_delete_thread_entry): Internal changes to avoid contention.
4890 	Calling routines changed accordingly.
4891
4892	* pthread.h: Modified cleanup macros to use new generic push and pop.
4893	Added destructor and atfork stacks to ptw32_threads_thread_t.
4894
4895	* cleanup.c (ptw32_handler_push, ptw32_handler_pop,
4896	ptw32_handler_pop_all): Renamed cleanup push and pop routines
4897	and made generic to handle destructors and atfork handlers as
4898	well.
4899
4900	* create.c (ptw32_start_call): New function is a wrapper for
4901	all new threads. It allows us to do some cleanup when the thread
4902	returns, ie. that is otherwise only done if the thread is cancelled.
4903
4904	* exit.c (ptw32_vacuum): New function contains code from
4905	pthread_exit() that we need in the new ptw32_start_call()
4906	as well.
4907
4908	* implement.h: Various additions and minor changes.
4909
4910	* pthread.h: Various additions and minor changes.
4911	Change cleanup handler macros to use generic handler push and pop
4912	functions.
4913
4914	* attr.c: Minor mods to all functions.
4915	(is_attr): Implemented missing function.
4916
4917	* create.c (pthread_create): More clean up.
4918
4919	* private.c (ptw32_find_thread_entry): Implement.
4920	(ptw32_delete_thread_entry): Implement.
4921	(ptw32_new_thread_entry): Implement.
4922	These functions manipulate the implementations internal thread
4923	table and are part of general code cleanup and modularisation.
4924	They replace ptw32_getthreadindex() which was removed.
4925
4926	* exit.c (pthread_exit): Changed to use the new code above.
4927
4928	* pthread.h: Add cancelability constants. Update comments.
4929
49301998-07-22  Ben Elliston  <bje at cygnus.com>
4931
4932	* attr.c (pthread_setstacksize): Update test of attr argument.
4933	(pthread_getstacksize): Likewise.
4934	(pthread_setstackaddr): Likewise.
4935	(pthread_getstackaddr): Likewise.
4936	(pthread_attr_init): No need to allocate any storage.
4937	(pthread_attr_destroy): No need to free any storage.
4938
4939	* mutex.c (is_attr): Not likely to be needed; remove.
4940	(remove_attr): Likewise.
4941	(insert_attr): Likewise.
4942
4943	* implement.h (ptw32_mutexattr_t): Moved to a public definition
4944	in pthread.h.  There was little gain in hiding these details.
4945	(ptw32_condattr_t): Likewise.
4946	(ptw32_attr_t): Likewise.
4947
4948	* pthread.h (pthread_atfork): Add function prototype.
4949	(pthread_attr_t): Moved here from implement.h.
4950
4951	* fork.c (pthread_atfork): Preliminary implementation.
4952	(ptw32_fork): Likewise.
4953
4954Wed Jul 22 00:16:22 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4955
4956	* cleanup.c (ptw32_cleanup_push): Implement.
4957	(ptw32_cleanup_pop): Implement.
4958	(ptw32_do_cancellation): Implement.
4959	These are private to the implementation. The real cleanup functions
4960	are macros. See below.
4961
4962	* pthread.h (pthread_cleanup_push): Implement as a macro.
4963	(pthread_cleanup_pop): Implement as a macro.
4964	Because these are macros which start and end a block, the POSIX scoping
4965	requirement is observed. See the comment in the file.
4966
4967	* exit.c (pthread_exit): Refine the code.
4968
4969	* create.c (pthread_create): Code cleanup.
4970
4971	* implement.h (RND_SIZEOF): Add RND_SIZEOF(T) to round sizeof(T)
4972	up to multiple of DWORD.
4973	Add function prototypes.
4974
4975	* private.c (ptw32_getthreadindex): "*thread" should have been
4976	"thread". Detect empty slot fail condition.
4977
49781998-07-20  Ben Elliston  <bje at cygnus.com>
4979
4980	* misc.c (pthread_once): Implement.  Don't use a per-application
4981	flag and mutex--make `pthread_once_t' contain these elements in
4982	their structure.  The earlier version had incorrect semantics.
4983
4984	* pthread.h (ptw32_once_flag): Add new variable.  Remove.
4985	(ptw32_once_lock): Add new mutex lock to ensure integrity of
4986	access to ptw32_once_flag.  Remove.
4987	(pthread_once): Add function prototype.
4988	(pthread_once_t): Define this type.
4989
4990Mon Jul 20 02:31:05 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
4991
4992	* private.c (ptw32_getthreadindex): Implement.
4993
4994	* pthread.h: Add application static data dependent on
4995	_PTHREADS_BUILD_DLL define. This is needed to avoid allocating
4996	non-sharable static data within the pthread DLL.
4997
4998	* implement.h: Add ptw32_cleanup_stack_t, ptw32_cleanup_node_t
4999	and PTW32_HASH_INDEX.
5000
5001	* exit.c (pthread_exit): Begin work on cleanup and de-allocate
5002	thread-private storage.
5003
5004	* create.c (pthread_create): Add thread to thread table.
5005	Keep a thread-private copy of the attributes with default values
5006	filled in when necessary. Same for the cleanup stack. Make
5007	pthread_create C run-time library friendly by using _beginthreadex()
5008	instead of CreateThread(). Fix error returns.
5009
5010Sun Jul 19 16:26:23 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
5011
5012	* implement.h: Rename pthreads_thread_count to ptw32_threads_count.
5013	Create ptw32_threads_thread_t struct to keep thread specific data.
5014
5015	* create.c: Rename pthreads_thread_count to ptw32_threads_count.
5016	(pthread_create): Handle errors from CreateThread().
5017
50181998-07-19  Ben Elliston  <bje at cygnus.com>
5019
5020	* condvar.c (pthread_cond_wait): Generalise.  Moved from here ..
5021	(cond_wait): To here.
5022	(pthread_cond_timedwait): Implement; use generalised cond_wait().
5023
5024	* pthread.h (pthread_key_t): Define this type.
5025	(pthread_key_create): Add function prototype.
5026	(pthread_setspecific): Likewise.
5027	(pthread_getspecific): Likwise.
5028	(pthread_key_delete): Likewise.
5029
5030	* tsd.c (pthread_key_create): Implement.
5031	(pthread_setspecific): Likewise.
5032	(pthread_getspecific): Likewise.
5033	(pthread_key_delete): Likewise.
5034
5035	* mutex.c (pthread_mutex_trylock): Return ENOSYS if this function
5036	is called on a Win32 platform which is not Windows NT.
5037
50381998-07-18  Ben Elliston  <bje at cygnus.com>
5039
5040	* condvar.c (pthread_condattr_init): Do not attempt to malloc any
5041	storage; none is needed now that condattr_t is an empty struct.
5042	(pthread_condattr_destory): Likewise; do not free storage.
5043	(pthread_condattr_setpshared): No longer supported; return ENOSYS.
5044	(pthread_condattr_getpshared): Likewise.
5045	(pthread_cond_init): Implement with help from Douglas Schmidt.
5046	Remember to initialise the cv's internal mutex.
5047	(pthread_cond_wait): Likewise.
5048	(pthread_cond_signal): Likewise.
5049	(pthread_cond_broadcast): Likewise.
5050	(pthread_cond_timedwait): Preliminary implementation, but I need
5051	to see some API documentation for `WaitForMultipleObject'.
5052	(pthread_destory): Implement.
5053
5054	* pthread.h (pthread_cond_init): Add function protoype.
5055	(pthread_cond_broadcast): Likewise.
5056	(pthread_cond_signal): Likewise.
5057	(pthread_cond_timedwait): Likewise.
5058	(pthread_cond_wait): Likewise.
5059	(pthread_cond_destroy): Likewise.
5060	(pthread_cond_t): Define this type.  Fix for u_int.  Do not assume
5061	that the mutex contained withing the pthread_cond_t structure will
5062	be a critical section.  Use our new POSIX type!
5063
5064	* implement.h (ptw32_condattr_t): Remove shared attribute.
5065
50661998-07-17  Ben Elliston  <bje at cygnus.com>
5067
5068	* pthread.h (PTHREADS_PROCESS_PRIVATE): Remove.
5069	(PTHREAD_PROCESS_SHARED): Likewise.  No support for mutexes shared
5070	across processes for now.
5071	(pthread_mutex_t): Use a Win32 CRITICAL_SECTION type for better
5072	performance.
5073
5074	* implement.h (ptw32_mutexattr_t): Remove shared attribute.
5075
5076	* mutex.c (pthread_mutexattr_setpshared): This optional function
5077	is no longer supported, since we want to implement POSIX mutex
5078	variables using the much more efficient Win32 critical section
5079	primitives.  Critical section objects in Win32 cannot be shared
5080	between processes.
5081	(pthread_mutexattr_getpshared): Likewise.
5082	(pthread_mutexattr_init): No need to malloc any storage; the
5083	attributes structure is now empty.
5084	(pthread_mutexattr_destroy): This is now a nop.
5085	(pthread_mutex_init): Use InitializeCriticalSection().
5086	(pthread_mutex_destroy): Use DeleteCriticalSection().
5087	(pthread_mutex_lock): Use EnterCriticalSection().
5088	(pthread_mutex_trylock): Use TryEnterCriticalSection().  This is
5089	not supported by Windows 9x, but trylock is a hack anyway, IMHO.
5090	(pthread_mutex_unlock): Use LeaveCriticalSection().
5091
50921998-07-14  Ben Elliston  <bje at cygnus.com>
5093
5094	* attr.c (pthread_attr_setstacksize): Implement.
5095	(pthread_attr_getstacksize): Likewise.
5096	(pthread_attr_setstackaddr): Likewise.
5097	(pthread_attr_getstackaddr): Likewise.
5098	(pthread_attr_init): Likewise.
5099	(pthread_attr_destroy): Likewise.
5100
5101	* condvar.c (pthread_condattr_init): Add `_cond' to function name.
5102
5103	* mutex.c (pthread_mutex_lock): Add `_mutex' to function name.
5104	(pthread_mutex_trylock): Likewise.
5105	(pthread_mutex_unlock): Likewise.
5106
5107	* pthread.h (pthread_condattr_setpshared): Fix typo.
5108	(pthread_attr_init): Add function prototype.
5109	(pthread_attr_destroy): Likewise.
5110	(pthread_attr_setstacksize): Likewise.
5111	(pthread_attr_getstacksize): Likewise.
5112	(pthread_attr_setstackaddr): Likewise.
5113	(pthread_attr_getstackaddr): Likewise.
5114
5115Mon Jul 13 01:09:55 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
5116
5117	* implement.h: Wrap in #ifndef _IMPLEMENT_H
5118
5119	* create.c (pthread_create): Map stacksize attr to Win32.
5120
5121	* mutex.c: Include implement.h
5122
51231998-07-13  Ben Elliston  <bje at cygnus.com>
5124
5125	* condvar.c (pthread_condattr_init): Implement.
5126	(pthread_condattr_destroy): Likewise.
5127	(pthread_condattr_setpshared): Likewise.
5128	(pthread_condattr_getpshared): Likewise.
5129
5130	* implement.h (PTHREAD_THREADS_MAX): Remove trailing semicolon.
5131	(PTHREAD_STACK_MIN): Specify; needs confirming.
5132	(ptw32_attr_t): Define this type.
5133	(ptw32_condattr_t): Likewise.
5134
5135	* pthread.h (pthread_mutex_t): Define this type.
5136	(pthread_condattr_t): Likewise.
5137	(pthread_mutex_destroy): Add function prototype.
5138	(pthread_lock): Likewise.
5139	(pthread_trylock): Likewise.
5140	(pthread_unlock): Likewise.
5141	(pthread_condattr_init): Likewise.
5142	(pthread_condattr_destroy): Likewise.
5143	(pthread_condattr_setpshared): Likewise.
5144	(pthread_condattr_getpshared): Likewise.
5145
5146	* mutex.c (pthread_mutex_init): Implement.
5147	(pthread_mutex_destroy): Likewise.
5148	(pthread_lock): Likewise.
5149	(pthread_trylock): Likewise.
5150	(pthread_unlock): Likewise.
5151
51521998-07-12  Ben Elliston  <bje at cygnus.com>
5153
5154	* implement.h (ptw32_mutexattr_t): Define this implementation
5155	internal type.  Application programmers only see a mutex attribute
5156	object as a void pointer.
5157
5158	* pthread.h (pthread_mutexattr_t): Define this type.
5159	(pthread_mutexattr_init): Add function prototype.
5160	(pthread_mutexattr_destroy): Likewise.
5161	(pthread_mutexattr_setpshared): Likewise.
5162	(pthread_mutexattr_getpshared): Likewise.
5163	(pthread_mutexattr_setprotocol): Likewise.
5164	(pthread_mutexattr_getprotocol): Likewise.
5165	(pthread_mutexattr_setprioceiling): Likewise.
5166	(pthread_mutexattr_getprioceiling): Likewise.
5167	(PTHREAD_PROCESS_PRIVATE): Define.
5168	(PTHREAD_PROCESS_SHARED): Define.
5169
5170	* mutex.c (pthread_mutexattr_init): Implement.
5171	(pthread_mutexattr_destroy): Implement.
5172	(pthread_mutexattr_setprotocol): Implement.
5173	(pthread_mutexattr_getprotocol): Likewise.
5174	(pthread_mutexattr_setprioceiling): Likewise.
5175	(pthread_mutexattr_getprioceiling): Likewise.
5176	(pthread_mutexattr_setpshared): Likewise.
5177	(pthread_mutexattr_getpshared): Likewise.
5178	(insert_attr): New function; very preliminary implementation!
5179	(is_attr): Likewise.
5180	(remove_attr): Likewise.
5181
5182Sat Jul 11 14:48:54 1998  Ross Johnson  <rpj at ixobrychus.canberra.edu.au>
5183
5184	* implement.h: Preliminary implementation specific defines.
5185
5186	* create.c (pthread_create): Preliminary implementation.
5187
51881998-07-11  Ben Elliston  <bje at cygnus.com>
5189
5190	* sync.c (pthread_join): Implement.
5191
5192	* misc.c (pthread_equal): Likewise.
5193
5194	* pthread.h (pthread_join): Add function prototype.
5195	(pthread_equal): Likewise.
5196
51971998-07-10  Ben Elliston  <bje at cygnus.com>
5198
5199	* misc.c (pthread_self): Implement.
5200
5201	* exit.c (pthread_exit): Implement.
5202
5203	* pthread.h (pthread_exit): Add function prototype.
5204	(pthread_self): Likewise.
5205	(pthread_t): Define this type.
5206
52071998-07-09  Ben Elliston  <bje at cygnus.com>
5208
5209	* create.c (pthread_create): A dummy stub right now.
5210
5211	* pthread.h (pthread_create): Add function prototype.
5212