summaryrefslogtreecommitdiff
path: root/ChangeLog
blob: 4836d5ffa82db8bdb52bf183a68cdac1af027a77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
Wed Jul 29 11:39:03 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* cleanup.c (_pthread_handler_push): Same as below.

	* create.c (pthread_create): Same as below.

	* private.c (_pthread_new_thread): Rename "new" to "new_thread".
	Since when has a C programmer been required to know C++?

Tue Jul 28 14:04:29 1998  Ross Johnson  <rpj@swan.canberra.edu.au>

	* implement.h: Add _PTHREAD_VALID macro.

	* sync.c (pthread_join): Modify to use the new thread
	type and _pthread_delete_thread(). Rename "target" to "thread".
	Remove extra local variable "target".
	(pthread_detach): Ditto.

	* signal.c (pthread_sigmask): Move init of "us" out of inner block.
	Fix instance of "this" should have been "us". Rename "us" to "thread".

	* sched.c (pthread_setschedparam): Modify to use the new thread
	type.
	(pthread_getschedparam): Ditto.

	* private.c (_pthread_find_thread): Fix return type and arg.

	* implement.h: Remove _PTHREAD_YES and _PTHREAD_NO.
	(_pthread_new_thread): Add prototype.
	(_pthread_find_thread): Ditto.
	(_pthread_delete_thread): Ditto.
	(_pthread_new_thread_entry): Remove prototype.
	(_pthread_find_thread_entry): Ditto.
	(_pthread_delete_thread_entry): Ditto.
	(  _PTHREAD_NEW, _PTHREAD_INUSE, _PTHREAD_EXITED, _PTHREAD_REUSE):
	Add.


	* create.c (pthread_create): Minor rename "us" to "new" (I need
	these cues but it doesn't stop me coming out with some major bugs
	at times).
	Load start_routine and arg into the thread so the wrapper can
	call it.

	* exit.c (pthread_exit): Fix pthread_this should be pthread_self.

	* cancel.c (pthread_setcancelstate): Change
 	_pthread_threads_thread_t * to pthread_t and init with
 	pthread_this().
	(pthread_setcanceltype): Ditto.

	* exit.c (_pthread_exit): Add new pthread_t arg.
	Rename _pthread_delete_thread_entry to _pthread_delete_thread.
	Rename "us" to "thread".
	(pthread_exit): Call _pthread_exit with added thread arg.

	* create.c (_pthread_start_call): Insert missing ")".
	Add "us" arg to _pthread_exit() call.
	(pthread_create): Modify to use new thread allocation scheme.

	* private.c: Added detailed explanation of the new thread
	allocation scheme.
	(_pthread_new_thread): Totally rewritten to use
	new thread allocation scheme.
	(_pthread_delete_thread): Ditto.
	(_pthread_find_thread): Obsolete.

Mon Jul 27 17:46:37 1998  Ross Johnson  <rpj@swan.canberra.edu.au>

	* create.c (pthread_create): Start of rewrite. Not completed yet.

	* private.c (_pthread_new_thread_entry): Start of rewrite. Not
	complete.

	* implement.h (_pthread_threads_thread): Rename, remove thread
	member, add win32handle and ptstatus members.
	(_pthread_t): Add.

	* pthread.h: pthread_t is no longer mapped directly to a Win32
	HANDLE type. This is so we can let the Win32 thread terminate and
	reuse the HANDLE while pthreads holds it's own thread ID until
	the last waiting join exits.

Mon Jul 27 00:20:37 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* private.c (_pthread_delete_thread_entry): Destroy the thread
 	entry attribute object before deleting the thread entry itself.

	* attr.c (pthread_attr_init): Initialise cancel_pending = FALSE.
	(pthread_attr_setdetachstate): Rename "detached" to "detachedstate".
	(pthread_attr_getdetachstate): Ditto.

	* exit.c (_pthread_exit): Fix incorrect check for detachedstate.

	* implement.h (_pthread_call_t): Remove env member. 

Sun Jul 26 13:06:12 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* implement.h (_pthread_new_thread_entry): Fix prototype.
	(_pthread_find_thread_entry): Ditto.
	(_pthread_delete_thread_entry): Ditto.
	(_pthread_exit): Add prototype.

	* exit.c (_pthread_exit): New function. Called from pthread_exit()
	and _pthread_start_call() to exit the thread. It allows an extra
	argument which is the return code passed to _endthreadex().
	(_pthread_exit): Move thread entry delete call from _pthread_vacuum()
	into here. Add more explanation of thread entry deletion.
	(_pthread_exit): Clarify comment.

	* create.c (_pthread_start_call): Change pthread_exit() call to
	_pthread_exit() call.

	* exit.c (_pthread_vacuum): Add thread entry deletion code
	moved from _pthread_start_call(). See next item.
	(pthread_exit): Remove longjmp(). Add mutex lock around thread table
	manipulation code. This routine now calls _enthreadex().

	* create.c (_pthread_start_call): Remove setjmp() call and move
	cleanup code out. Call pthread_exit(NULL) to terminate the thread.

1998-07-26  Ben Elliston  <bje@cygnus.com>

	* tsd.c (pthread_getspecific): Update comments.

	* mutex.c (pthread_mutexattr_setpshared): Not supported; remove.
	(pthread_mutexattr_getpshared): Likewise.

	* pthread.h (pthread_mutexattr_setpshared): Remove prototype.
	(pthread_mutexattr_getpshared): Likewise.

Sun Jul 26 00:09:59 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* sync.c: Rename all instances of _pthread_count_mutex to
	_pthread_table_mutex.

	* implement.h: Rename _pthread_count_mutex to
	_pthread_table_mutex.

	* global.c: Rename _pthread_count_mutex to
	_pthread_table_mutex.

	* create.c (pthread_create): Add critical sections.
	(_pthread_start_call): Rename _pthread_count_mutex to
	_pthread_table_mutex.

	* cancel.c (pthread_setcancelstate): Fix indirection bug and rename
	"this" to "us".

	* signal.c (pthread_sigmask): Rename "this" to "us" and fix some
	minor syntax errors. Declare "us" and initialise it.

	* sync.c (pthread_detach): Rename "this" to "target".

	* pthread.h: Converting PTHREAD_* defines to alias the (const int)
	values in global.c.

	* global.c: Started converting PTHREAD_* defines to (const int) as
 	a part of making the eventual pthreads DLL binary compatible
 	through version changes.

	* condvar.c (cond_wait): Add cancelation point. This applies the
	point to both pthread_cond_wait() and pthread_cond_timedwait().

	* exit.c (pthread_exit): Rename "this" to "us".

	* implement.h: Add comment.

	* sync.c (pthread_join): I've satisfied myself that pthread_detach()
	does set the detached attribute in the thread entry attributes
	to PTHREAD_CREATE_DETACHED. "if" conditions were changed to test
	that attribute instead of a separate flag.

	* create.c (pthread_create): Rename "this" to "us".
	(pthread_create): cancelstate and canceltype are not attributes
	so the copy to thread entry attribute storage was removed.
	Only the thread itself can change it's cancelstate or canceltype,
	ie. the thread must exist already.

	* private.c (_pthread_delete_thread_entry): Mutex locks removed.
	Mutexes must be applied at the caller level.
	(_pthread_new_thread_entry): Ditto.
	(_pthread_new_thread_entry): Init cancelstate, canceltype, and
	cancel_pending to default values.
	(_pthread_new_thread_entry): Rename "this" to "new".
	(_pthread_find_thread_entry): Rename "this" to "entry".
	(_pthread_delete_thread_entry): Rename "thread_entry" to "entry".

	* create.c (_pthread_start_call): Mutexes changed to
	_pthread_count_mutex. All access to the threads table entries is
	under the one mutex. Otherwise chaos reigns.

Sat Jul 25 23:16:51 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* implement.h (_pthread_threads_thread): Move cancelstate and
 	canceltype members out of pthread_attr_t into here.

	* fork.c (fork): Add comment.

1998-07-25  Ben Elliston  <bje@cygnus.com>

	* fork.c (fork): Autoconfiscate.

Sat Jul 25 00:00:13 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* create.c (_pthread_start_call): Set thread priority.  Ensure our
 	thread entry is removed from the thread table but only if
 	pthread_detach() was called and there are no waiting joins.
	(pthread_create): Set detach flag in thread entry if the 
	thread is created PTHREAD_CREATE_DETACHED.

	* pthread.h (pthread_attr_t): Rename member "detachedstate".

	* attr.c (pthread_attr_init): Rename attr members.

	* exit.c (pthread_exit): Fix indirection mistake.

	* implement.h (_PTHREAD_THREADS_TABLE_INDEX): Add.

	* exit.c (_pthread_vacuum): Fix incorrect args to
	_pthread_handler_pop_all() calls.
	Make thread entry removal conditional.

	* sync.c (pthread_join): Add multiple join and async detach handling.

	* implement.h (_PTHREAD_THREADS_TABLE_INDEX): Add.

	* global.c (_pthread_threads_mutex_table): Add.

	* implement.h (_pthread_once_flag): Remove.
	(_pthread_once_lock): Ditto.
	(_pthread_threads_mutex_table): Add.

	* global.c (_pthread_once_flag): Remove.
	(_pthread_once_lock): Ditto.

	* sync.c (pthread_join): Fix tests involving new return value
	from _pthread_find_thread_entry().
	(pthread_detach): Ditto.

	* private.c (_pthread_find_thread_entry): Failure return code
	changed from -1 to NULL.

Fri Jul 24 23:09:33 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* create.c (pthread_create): Change . to -> in sigmask memcpy() args.

	* pthread.h: (pthread_cancel): Add function prototype.
	(pthread_testcancel): Ditto.

1998-07-24  Ben Elliston  <bje@cygnus.com>

	* pthread.h (pthread_condattr_t): Rename dummy structure member.
	(pthread_mutexattr_t): Likewise.

Fri Jul 24 21:13:55 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* cancel.c (pthread_cancel): Implement.
	(pthread_testcancel): Implement.

	* exit.c (pthread_exit): Add comment explaining the longjmp().

	* implement.h (_pthread_threads_thread_t): New member cancelthread.
	(_PTHREAD_YES): Define.
	(_PTHREAD_NO): Define.
	(RND_SIZEOF): Remove.

	* create.c (pthread_create): Rename cancelability to cancelstate.

	* pthread.h (pthread_attr_t): Rename cancelability to cancelstate.
	(PTHREAD_CANCELED): Define.

1998-07-24  Ben Elliston  <bje@cygnus.com>

	* pthread.h (SIG_BLOCK): Define if not already defined.
	(SIG_UNBLOCK): Likewise.
	(SIG_SETMASK): Likewise.
	(pthread_attr_t): Add signal mask member.
	(pthread_sigmask): Add function prototype.

	* signal.c (pthread_sigmask): Implement.

	* create.c: #include <string.h> to get a prototype for memcpy().
	(pthread_create): New threads inherit their creator's signal
	mask.  Copy the signal mask to the new thread structure if we know
	about signals.
	
Fri Jul 24 16:33:17 1998  Ross Johnson  <rpj@swan.canberra.edu.au>

	* fork.c (pthread_atfork): Add all the necessary push calls.
	Local implementation semantics:
	If we get an ENOMEM at any time then ALL handlers
	(including those from previous pthread_atfork() calls) will be
	popped off each of the three atfork stacks before we return.
	(fork): Add all the necessary pop calls. Add the thread cancellation
	and join calls to the child fork.
	Add #includes.

	* implement.h: (_pthread_handler_push): Fix return type and stack arg
	type in prototype.
	(_pthread_handler_pop): Fix stack arg type in prototype.
	(_pthread_handler_pop_all): Fix stack arg type in prototype.

	* cleanup.c (_pthread_handler_push): Change return type to int and
	return ENOMEM if malloc() fails.

	* sync.c (pthread_detach): Use equality test, not assignment.

	* create.c (_pthread_start_call): Add call to Win32 CloseHandle()
	if thread is detached.

1998-07-24  Ben Elliston  <bje@cygnus.com>

	* sync.c (pthread_detach): Close the Win32 thread handle to
	emulate detached (or daemon) threads.

Fri Jul 24 03:00:25 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* sync.c (pthread_join): Save valueptr arg in joinvalueptr for
	pthread_exit() to use.

	* private.c (_pthread_new_thread_entry): Initialise joinvalueptr to
	NULL.

	* create.c (_pthread_start_call): Rewrite to facilitate joins.
	pthread_exit() will do a longjmp() back to here. Does appropriate
	cleanup and exit/return from the thread.
	(pthread_create): _beginthreadex() now passes a pointer to our
	thread table entry instead of just the call member of that entry.

	* implement.h (_pthread_threads_thread): New member 
	void ** joinvalueptr.
	(_pthread_call_t): New member jmpbuf env.

	* exit.c (pthread_exit): Major rewrite to handle joins and handing
	value pointer to joining thread. Uses longjmp() back to 
	_pthread_start_call().

	* create.c (pthread_create): Ensure values of new attribute members
	are copied to the thread attribute object.

	* attr.c (pthread_attr_destroy):  Fix merge conflicts.
	(pthread_attr_getdetachstate):  Fix merge conflicts.
	(pthread_attr_setdetachstate):  Fix merge conflicts.

	* pthread.h:  Fix merge conflicts.

	* sync.c (pthread_join): Fix merge conflicts.

Fri Jul 24 00:21:21 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* sync.c (pthread_join): Add check for valid and joinable
	thread.
	(pthread_detach): Implement. After checking for a valid and joinable
	thread, it's still a no-op.

	* private.c (_pthread_find_thread_entry): Bug prevented returning
	an error value in some cases.

	* attr.c (pthread_attr_setdetachedstate): Implement.
	(pthread_attr_getdetachedstate): Implement.

	* implement.h: Move more hidden definitions into here from
	pthread.h.

1998-07-24  Ben Elliston  <bje@cygnus.com>

	* pthread.h (PTHREAD_CREATE_JOINABLE): Define.
	(PTHREAD_CREATE_DETACHED): Likewise.
	(pthread_attr_t): Add new structure member `detached'.
	(pthread_attr_getdetachstate): Add function prototype.
	(pthread_attr_setdetachstate): Likewise.

	* sync.c (pthread_join): Return if the target thread is detached.

	* attr.c (pthread_attr_init): Initialise cancelability and
	canceltype structure members.
	(pthread_attr_getdetachstate): Implement.
	(pthread_attr_setdetachstate): Likewise.

	* implement.h (_PTHREAD_CANCEL_DEFAULTS): Remove.  Bit fields
	proved to be too cumbersome.  Set the defaults in attr.c using the
	public PTHREAD_CANCEL_* constants.

	* cancel.c: New file.

	* pthread.h (sched_param): Define this type.
	(pthread_attr_getschedparam): Add function prototype.
	(pthread_attr_setschedparam): Likewise.
	(pthread_setcancelstate): Likewise.
	(pthread_setcanceltype): Likewise.
	(sched_get_priority_min): Likewise.
	(sched_get_priority_max): Likewise.
	(pthread_mutexattr_setprotocol): Remove; not supported.
	(pthread_mutexattr_getprotocol): Likewise.
	(pthread_mutexattr_setprioceiling): Likewise.
	(pthread_mutexattr_getprioceiling): Likewise.
	(pthread_attr_t): Add canceltype member.  Update comments.
	(SCHED_OTHER): Define this scheduling policy constant.
	(SCHED_FIFO): Likewise.
	(SCHED_RR): Likewise.
	(SCHED_MIN): Define the lowest possible value for this constant.
	(SCHED_MAX): Likewise, the maximum possible value.
	(PTHREAD_CANCEL_ASYNCHRONOUS): Redefine.
	(PTHREAD_CANCEL_DEFERRED): Likewise.
	
	* sched.c: New file.
	(pthread_setschedparam): Implement.
	(pthread_getschedparam): Implement.
	(sched_get_priority_max): Validate policy argument.
	(sched_get_priority_min): Likewise.

	* mutex.c (pthread_mutexattr_setprotocol): Remove; not supported.
	(pthread_mutexattr_getprotocol): Likewise.
	(pthread_mutexattr_setprioceiling): Likewise.
	(pthread_mutexattr_getprioceiling): Likewise.

Fri Jul 24 00:21:21 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* create.c (pthread_create): Arg to _pthread_new_thread_entry()
	changed. See next entry. Move mutex locks out. Changes made yesterday
	and today allow us to start the new thread running rather than
	temporarily suspended.

	* private.c (_pthread_new_thread_entry): _pthread_thread_table
	was changed back to a table of thread structures rather than pointers.
	As such we're trading storage for increaded speed. This routine
	was modified to work with the new table. Mutex lock put in around
	global data accesses.
	(_pthread_find_thread_entry): Ditto
	(_pthread_delete_thread_entry): Ditto

Thu Jul 23 23:25:30 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* global.c: New. Global data objects declared here. These moved from
	pthread.h.

	* pthread.h: Move implementation hidden definitions into
	implement.h.

	* implement.h: Move implementation hidden definitions from
	pthread.h. Add constants to index into the different handler stacks.

	* cleanup.c (_pthread_handler_push): Simplify args. Restructure.
	(_pthread_handler_pop): Simplify args. Restructure.
	(_pthread_handler_pop_all): Simplify args. Restructure.

Wed Jul 22 00:16:22 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* attr.c, implement.h, pthread.h, ChangeLog: Resolve CVS merge
	conflicts.

	* private.c (_pthread_find_thread_entry): Changes to return type
	to support leaner _pthread_threads_table[] which now only stores
	_pthread_thread_thread_t *.
	(_pthread_new_thread_entry): Internal changes.
	(_pthread_delete_thread_entry): Internal changes to avoid contention.
 	Calling routines changed accordingly.

	* pthread.h: Modified cleanup macros to use new generic push and pop.
	Added destructor and atfork stacks to _pthread_threads_thread_t.

	* cleanup.c (_pthread_handler_push, _pthread_handler_pop,
	_pthread_handler_pop_all): Renamed cleanup push and pop routines
	and made generic to handle destructors and atfork handlers as
	well.

	* create.c (_pthread_start_call): New function is a wrapper for
	all new threads. It allows us to do some cleanup when the thread
	returns, ie. that is otherwise only done if the thread is cancelled.

	* exit.c (_pthread_vacuum): New function contains code from 
	pthread_exit() that we need in the new _pthread_start_call()
	as well.

	* implement.h: Various additions and minor changes.

	* pthread.h: Various additions and minor changes.
	Change cleanup handler macros to use generic handler push and pop
	functions.

	* attr.c: Minor mods to all functions.
	(is_attr): Implemented missing function.

	* create.c (pthread_create): More clean up.

	* private.c (_pthread_find_thread_entry): Implement.
	(_pthread_delete_thread_entry): Implement.
	(_pthread_new_thread_entry): Implement.
	These functions manipulate the implementations internal thread
	table and are part of general code cleanup and modularisation.
	They replace _pthread_getthreadindex() which was removed.

	* exit.c (pthread_exit): Changed to use the new code above.

	* pthread.h: Add cancelability constants. Update comments.

1998-07-22  Ben Elliston  <bje@cygnus.com>

	* attr.c (pthread_setstacksize): Update test of attr argument.
	(pthread_getstacksize): Likewise.
	(pthread_setstackaddr): Likewise.
	(pthread_getstackaddr): Likewise.
	(pthread_attr_init): No need to allocate any storage.
	(pthread_attr_destroy): No need to free any storage.

	* mutex.c (is_attr): Not likely to be needed; remove.
	(remove_attr): Likewise.
	(insert_attr): Likewise.

	* implement.h (_pthread_mutexattr_t): Moved to a public definition
	in pthread.h.  There was little gain in hiding these details.
	(_pthread_condattr_t): Likewise.
	(_pthread_attr_t): Likewise.

	* pthread.h (pthread_atfork): Add function prototype.
	(pthread_attr_t): Moved here from implement.h.

	* fork.c (pthread_atfork): Preliminary implementation.
	(_pthread_fork): Likewise.

Wed Jul 22 00:16:22 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* cleanup.c (_pthread_cleanup_push): Implement.
	(_pthread_cleanup_pop): Implement.
	(_pthread_do_cancellation): Implement.
	These are private to the implementation. The real cleanup functions
	are macros. See below.

	* pthread.h (pthread_cleanup_push): Implement as a macro.
	(pthread_cleanup_pop): Implement as a macro.
	Because these are macros which start and end a block, the POSIX scoping
	requirement is observed. See the comment in the file.

	* exit.c (pthread_exit): Refine the code.

	* create.c (pthread_create): Code cleanup.

	* implement.h (RND_SIZEOF): Add RND_SIZEOF(T) to round sizeof(T)
	up to multiple of DWORD.
	Add function prototypes.

	* private.c (_pthread_getthreadindex): "*thread" should have been 
	"thread". Detect empty slot fail condition.

1998-07-20  Ben Elliston  <bje@cygnus.com>

	* misc.c (pthread_once): Implement.  Don't use a per-application
	flag and mutex--make `pthread_once_t' contain these elements in
	their structure.  The earlier version had incorrect semantics.
	
	* pthread.h (_pthread_once_flag): Add new variable.  Remove.
	(_pthread_once_lock): Add new mutex lock to ensure integrity of
	access to _pthread_once_flag.  Remove.
	(pthread_once): Add function prototype.
	(pthread_once_t): Define this type.
	
Mon Jul 20 02:31:05 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* private.c (_pthread_getthreadindex): Implement.

	* pthread.h: Add application static data dependent on
	_PTHREADS_BUILD_DLL define. This is needed to avoid allocating
	non-sharable static data within the pthread DLL.

	* implement.h: Add _pthread_cleanup_stack_t, _pthread_cleanup_node_t
	and _PTHREAD_HASH_INDEX.

	* exit.c (pthread_exit): Begin work on cleanup and de-allocate
	thread-private storage.

	* create.c (pthread_create): Add thread to thread table.
	Keep a thread-private copy of the attributes with default values
	filled in when necessary. Same for the cleanup stack. Make 
	pthread_create C run-time library friendly by using _beginthreadex()
	instead of CreateThread(). Fix error returns.

Sun Jul 19 16:26:23 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* implement.h: Rename pthreads_thread_count to _pthread_threads_count.
	Create _pthread_threads_thread_t struct to keep thread specific data.

	* create.c: Rename pthreads_thread_count to _pthread_threads_count.
	(pthread_create): Handle errors from CreateThread().

1998-07-19  Ben Elliston  <bje@cygnus.com>

	* condvar.c (pthread_cond_wait): Generalise.  Moved from here ..
	(cond_wait): To here.
	(pthread_cond_timedwait): Implement; use generalised cond_wait().

	* pthread.h (pthread_key_t): Define this type.
	(pthread_key_create): Add function prototype.
	(pthread_setspecific): Likewise.
	(pthread_getspecific): Likwise.
	(pthread_key_delete): Likewise.

	* tsd.c (pthread_key_create): Implement.
	(pthread_setspecific): Likewise.
	(pthread_getspecific): Likewise.
	(pthread_key_delete): Likewise.

	* mutex.c (pthread_mutex_trylock): Return ENOSYS if this function
	is called on a Win32 platform which is not Windows NT.

1998-07-18  Ben Elliston  <bje@cygnus.com>

	* condvar.c (pthread_condattr_init): Do not attempt to malloc any
	storage; none is needed now that condattr_t is an empty struct.
	(pthread_condattr_destory): Likewise; do not free storage.
	(pthread_condattr_setpshared): No longer supported; return ENOSYS.
	(pthread_condattr_getpshared): Likewise.
	(pthread_cond_init): Implement with help from Douglas Schmidt.
	Remember to initialise the cv's internal mutex.
	(pthread_cond_wait): Likewise.
	(pthread_cond_signal): Likewise.
	(pthread_cond_broadcast): Likewise.
	(pthread_cond_timedwait): Preliminary implementation, but I need
	to see some API documentation for `WaitForMultipleObject'.
	(pthread_destory): Implement.

	* pthread.h (pthread_cond_init): Add function protoype.
	(pthread_cond_broadcast): Likewise.
	(pthread_cond_signal): Likewise.
	(pthread_cond_timedwait): Likewise.
	(pthread_cond_wait): Likewise.
	(pthread_cond_destroy): Likewise.
	(pthread_cond_t): Define this type.  Fix for u_int.  Do not assume
	that the mutex contained withing the pthread_cond_t structure will
	be a critical section.  Use our new POSIX type!

	* implement.h (_pthread_condattr_t): Remove shared attribute.

1998-07-17  Ben Elliston  <bje@cygnus.com>

	* pthread.h (PTHREADS_PROCESS_PRIVATE): Remove.
	(PTHREAD_PROCESS_SHARED): Likewise.  No support for mutexes shared
	across processes for now.
	(pthread_mutex_t): Use a Win32 CRITICAL_SECTION type for better
	performance.
	
	* implement.h (_pthread_mutexattr_t): Remove shared attribute.
	
	* mutex.c (pthread_mutexattr_setpshared): This optional function
	is no longer supported, since we want to implement POSIX mutex
	variables using the much more efficient Win32 critical section
	primitives.  Critical section objects in Win32 cannot be shared
	between processes.
	(pthread_mutexattr_getpshared): Likewise.
	(pthread_mutexattr_init): No need to malloc any storage; the
	attributes structure is now empty.
	(pthread_mutexattr_destroy): This is now a nop.
	(pthread_mutex_init): Use InitializeCriticalSection().
	(pthread_mutex_destroy): Use DeleteCriticalSection().
	(pthread_mutex_lock): Use EnterCriticalSection().
	(pthread_mutex_trylock): Use TryEnterCriticalSection().  This is
	not supported by Windows 9x, but trylock is a hack anyway, IMHO.
	(pthread_mutex_unlock): Use LeaveCriticalSection().

1998-07-14  Ben Elliston  <bje@cygnus.com>

	* attr.c (pthread_attr_setstacksize): Implement.
	(pthread_attr_getstacksize): Likewise.
	(pthread_attr_setstackaddr): Likewise.
	(pthread_attr_getstackaddr): Likewise.
	(pthread_attr_init): Likewise.
	(pthread_attr_destroy): Likewise.
	
	* condvar.c (pthread_condattr_init): Add `_cond' to function name.

	* mutex.c (pthread_mutex_lock): Add `_mutex' to function name.
	(pthread_mutex_trylock): Likewise.
	(pthread_mutex_unlock): Likewise.

	* pthread.h (pthread_condattr_setpshared): Fix typo.
	(pthread_attr_init): Add function prototype.
	(pthread_attr_destroy): Likewise.
	(pthread_attr_setstacksize): Likewise.
	(pthread_attr_getstacksize): Likewise.
	(pthread_attr_setstackaddr): Likewise.
	(pthread_attr_getstackaddr): Likewise.
	
Mon Jul 13 01:09:55 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* implement.h: Wrap in #ifndef _IMPLEMENT_H

	* create.c (pthread_create): Map stacksize attr to Win32.

	* mutex.c: Include implement.h

1998-07-13  Ben Elliston  <bje@cygnus.com>

	* condvar.c (pthread_condattr_init): Implement.
	(pthread_condattr_destroy): Likewise.
	(pthread_condattr_setpshared): Likewise.
	(pthread_condattr_getpshared): Likewise.
	
	* implement.h (PTHREAD_THREADS_MAX): Remove trailing semicolon.
	(PTHREAD_STACK_MIN): Specify; needs confirming.
	(_pthread_attr_t): Define this type.
	(_pthread_condattr_t): Likewise.

	* pthread.h (pthread_mutex_t): Define this type.
	(pthread_condattr_t): Likewise.
	(pthread_mutex_destroy): Add function prototype.
	(pthread_lock): Likewise.
	(pthread_trylock): Likewise.
	(pthread_unlock): Likewise.
	(pthread_condattr_init): Likewise.
	(pthread_condattr_destroy): Likewise.
	(pthread_condattr_setpshared): Likewise.
	(pthread_condattr_getpshared): Likewise.

	* mutex.c (pthread_mutex_init): Implement.
	(pthread_mutex_destroy): Likewise.
	(pthread_lock): Likewise.
	(pthread_trylock): Likewise.
	(pthread_unlock): Likewise.

1998-07-12  Ben Elliston  <bje@cygnus.com>

	* implement.h (_pthread_mutexattr_t): Define this implementation
	internal type.  Application programmers only see a mutex attribute
	object as a void pointer.

	* pthread.h (pthread_mutexattr_t): Define this type.
	(pthread_mutexattr_init): Add function prototype.
	(pthread_mutexattr_destroy): Likewise.
	(pthread_mutexattr_setpshared): Likewise.
	(pthread_mutexattr_getpshared): Likewise.
	(pthread_mutexattr_setprotocol): Likewise.
	(pthread_mutexattr_getprotocol): Likewise.
	(pthread_mutexattr_setprioceiling): Likewise.
	(pthread_mutexattr_getprioceiling): Likewise.
	(PTHREAD_PROCESS_PRIVATE): Define.
	(PTHREAD_PROCESS_SHARED): Define.

	* mutex.c (pthread_mutexattr_init): Implement.
	(pthread_mutexattr_destroy): Implement.
	(pthread_mutexattr_setprotocol): Implement.
	(pthread_mutexattr_getprotocol): Likewise.
	(pthread_mutexattr_setprioceiling): Likewise.
	(pthread_mutexattr_getprioceiling): Likewise.
	(pthread_mutexattr_setpshared): Likewise.
	(pthread_mutexattr_getpshared): Likewise.
	(insert_attr): New function; very preliminary implementation!
	(is_attr): Likewise.
	(remove_attr): Likewise.
	
Sat Jul 11 14:48:54 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>

	* implement.h: Preliminary implementation specific defines.

	* create.c (pthread_create): Preliminary implementation.

1998-07-11  Ben Elliston  <bje@cygnus.com>

	* sync.c (pthread_join): Implement.

	* misc.c (pthread_equal): Likewise.
	
	* pthread.h (pthread_join): Add function prototype.
	(pthread_equal): Likewise.
	
1998-07-10  Ben Elliston  <bje@cygnus.com>

	* misc.c (pthread_self): Implement.

	* exit.c (pthread_exit): Implement.

	* pthread.h (pthread_exit): Add function prototype.
	(pthread_self): Likewise.
	(pthread_t): Define this type.

1998-07-09  Ben Elliston  <bje@cygnus.com>

	* create.c (pthread_create): A dummy stub right now.

	* pthread.h (pthread_create): Add function prototype.