* threads.c (create_thread): Don't unwind dynwind chain of parent
[bpt/guile.git] / libguile / ChangeLog
CommitLineData
b4debead
MD
12003-01-22 Mikael Djurfeldt <djurfeldt@nada.kth.se>
2
3 * threads.c (create_thread): Don't unwind dynwind chain of parent
4 thread before creation. Just start the new thread with an empty
5 dynwind chain.
6
93f26b7b
MD
72003-01-20 Mikael Djurfeldt <djurfeldt@nada.kth.se>
8
9 * evalext.c, evalext.h (scm_self_evaluating_p): New function.
10
38d8927c
MD
112003-01-10 Mikael Djurfeldt <djurfeldt@nada.kth.se>
12
41c96c32
MD
13 * threads.c (scm_timed_wait_condition_variable): Support timed
14 waiting also for simple condition variables.
15
38d8927c
MD
16 * goops.c (TEST_CHANGE_CLASS): Use scm_change_object_class instead
17 of calling the procedure change-object-class.
18
9cf5d9b7
MD
192003-01-09 Mikael Djurfeldt <djurfeldt@nada.kth.se>
20
21 * ramap.c (scm_ramapc): Typo in error message.
22
bbf8d523
MD
232003-01-08 Mikael Djurfeldt <djurfeldt@nada.kth.se>
24
b46fae00
MD
25 * goops.c (scm_sys_prep_layout_x): Bugfix: Only create layout for
26 slots with instance allocation.
27
bbf8d523
MD
28 * goops.c, goops.h (scm_class_extended_generic_with_setter): New
29 class.
30 (scm_compute_applicable_methods): Use scm_generic_function_methods.
31
32 * goops.c (scm_generic_function_methods): Support extended
33 generic functions.
34
ebf9b47c
MD
352002-12-29 Mikael Djurfeldt <djurfeldt@nada.kth.se>
36
37 * eval.c (unmemocopy): Bugfix: scm_sym_delay --> scm_sym_future.
2e37d6a2 38 Thanks to Neil for pointing this out!
ebf9b47c 39
14a9ba3f
NJ
402002-12-29 Neil Jerram <neil@ossau.uklinux.net>
41
42 * lang.h: Remove declarations matching definitions removed from
43 lang.c (just below).
44
c6a040a8
NJ
452002-12-28 Neil Jerram <neil@ossau.uklinux.net>
46
6054d805
NJ
47 * lang.c (scm_nil_cons, scm_nil_car, scm_nil_cdr, scm_null,
48 scm_m_while, scm_nil_eq): Remove definitions that were superfluous
49 and already commented out.
50
c6a040a8
NJ
51 * read.h (scm_lreadparen), read.c (scm_lreadr, scm_read_token,
52 scm_lreadparen): Support reading vectors with Elisp syntax if
53 SCM_ELISP_READ_EXTENSIONS is defined. (SCM_ELISP_READ_EXTENSIONS
54 is not currently defined, and there isn't even a configure switch
55 to enable it yet.)
56
3742c12f
MV
572002-12-26 Marius Vollmer <mvo@zagadka.ping.de>
58
59 * Makefile.am (c-tokenize.o): Refer to source via $< so that vpath
60 builds work.
61 (EXTRA_DIST): Added version.h.in.
62
fb50ef08
MD
632002-12-21 Mikael Djurfeldt <djurfeldt@nada.kth.se>
64
65 This change makes it possible for one thread to do lazy sweeping
66 while other threads are running. Now only the mark phase need to
67 have all threads asleep. We should look further into this issue.
68 Presently, I've put the locking of scm_i_sweep_mutex at
69 "conservative" places due to my current lack of knowledge about
70 the garbage collector. Please feel free to restrict these regions
71 further to allow for maximal parallelism!
72
73 * gc.c, gc.h (scm_i_sweep_mutex): New mutex.
74
75 * gc.c (scm_gc_for_newcell), gc-malloc.c (scm_realloc,
76 scm_gc_register_collectable_memory): Substitute locking of
77 scm_i_sweep_mutex for calls to scm_i_thread_put_to_sleep.
78 (scm_igc): Lock sweep mutex here instead of in callers; Calls to
79 scm_i_thread_put_to_sleep/scm_i_thread_wake_up used to demarkate
80 the single-thread section (which now only contains the mark
81 phase).
82 (scm_gc): Don't lock sweeo mutex here since scm_igc locks it;
83 Removed SCM_DEFER/ALLOW_INTS. Simply call scm_igc directly.
84
85 * threads.c (gc_section_mutex): Removed.
86
9ed24633
MD
872002-12-19 Mikael Djurfeldt <mdj@kvast.blakulla.net>
88
0d48aca5
MD
89 * threads.c (create_thread): Clear parent field in root state in
90 order not to unnecessarily remember dead threads.
91
9ed24633
MD
92 * eval.c (call_subr2o_1, call_lsubr2_2): New functions.
93 (scm_trampoline_1, scm_trampoline_2): Use them.
94
29717c89
MD
952002-12-18 Mikael Djurfeldt <mdj@kvast.blakulla.net>
96
97 Partial introduction of real plugin interface.
98
99 * Makefile.am (modinclude_HEADERS): Added threads-plugin.h.
100 (EXTRA_DIST): Added threads-plugin.c.
101
102 * threads-plugin.h, threads-plugin.c: New files.
103
104 * threads.h: #include "libguile/threads-plugin.h".
105
106 * threads.c: #include "libguile/threads-plugin.c".
107
108 * pthread-threads.c: Temporarily remove debugging functions.
109
110 * threads.c, threads.h (scm_yield): Added back.
111
e29e0b09
MD
1122002-12-18 Mikael Djurfeldt <mdj@kvast.blakulla.net>
113
114 * threads.c (really_launch): Detach before unlocking
115 thread_admin_mutex in order not to risk being joined.
116 (scm_i_thread_put_to_sleep, scm_i_thread_wake_up): Keep
117 thread_admin_mutex locked during GC.
118
119 * pthread-threads.c, pthread-threads.h: Improvements to debugging
120 functions.
121
0b6843b1 1222002-12-16 Mikael Djurfeldt <mdj@kvast.blakulla.net>
93cd4dcd 123
6da2dfc4
MD
124 * pthread-threads.c, pthread-threads.h (SCM_DEBUG_THREADS): Added
125 support for debugging mutex operations.
126
1b92fb6b
MD
127 * threads.c (scm_thread): Removed filed joining_threads.
128 (thread_print): Print thread number as well as address of thread
129 structure.
0b6843b1
MD
130 (scm_join_thread): Bugfix.
131 (scm_lock_mutex, scm_try_mutex, scm_unlock_mutex,
132 scm_timed_wait_condition_variable, scm_signal_condition_variable,
133 scm_broadcast_condition_variable): Use the low-level API.
134 (scm_all_threads): Return copy of thread list (to prevent
135 unintended destruction).
136 (scm_threads_prehistory): Initialize heap_mutex of fake thread.
1b92fb6b 137
93cd4dcd
MD
138 * pthread-threads.c, pthread-threads.h, threads.c: Fixes to
139 pthread "native" recursive mutex support.
140
2ff4f181
MD
1412002-12-15 Mikael Djurfeldt <djurfeldt@nada.kth.se>
142
28d52ebb
MD
143 * __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): New definitions.
144 Simply lock a thread C API recursive mutex.
145 (SCM_NONREC_CRITICAL_SECTION_START,
146 SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
147 SCM_REC_CRITICAL_SECTION_END): Removed.
148
149 * eval.c: Replaced SOURCE_SECTION_START / SOURCE_SECTION_END with
150 direct calls to scm_rec_mutex_lock / unlock around the three calls
151 to scm_m_expand_body.
152
153 * eval.c, eval.h (promise_free): New function.
154 (scm_force): Rewritten; Now thread-safe; Removed
155 SCM_DEFER/ALLOW_INTS.
156
157 * pthread-threads.h: Added partially implemented plugin interface
158 for recursive mutexes. These are, for now, only intended to be
159 used internally within the Guile implementation.
160
161 * pthread-threads.c: New file.
162
163 * threads.c: Conditionally #include "pthread-threads.c".
164
165 * eval.c, eval.h (scm_makprom, scm_force): Rewritten to be
166 thread-safe;
167
168 * snarf.h (SCM_MUTEX, SCM_GLOBAL_MUTEX, SCM_REC_MUTEX,
169 SCM_GLOBAL_REC_MUTEX): New macros.
170
171 * eval.c, threads.c, threads.h, snarf.h: Rewrote critical section
172 macros---use mutexes instead.
173
174 * tags.h (SCM_IM_FUTURE): New tag.
175
176 * eval.c (scm_m_future): New primitive macro.
177 (SCM_CEVAL): Support futures.
178 (unmemocopy): Support unmemoization of futures.
179
180 * print.c (scm_isymnames): Name of future isym.
181
2ff4f181
MD
182 * version.c: Unmade some changes to my private copy that got
183 committed by mistake.
184
392d2833
MD
1852002-12-11 Mikael Djurfeldt <mdj@kvast.blakulla.net>
186
e200ddee
MD
187 * gc-malloc.c, gc.h, init.c: Reverted gc-malloc change of
188 2002-12-10.
189
392d2833
MD
190 * gc.c (scm_igc): Don't call scm_i_thread_invalidate_freelists.
191
192 * gc.c (scm_gc_sweep): Call it here instead, which is a more
193 logical place.
194
195 * threads.c (create_thread): Remember root object until the handle
196 of the new thread is on all_threads list.
197
198 * root.c (scm_make_root): Moved copying of fluids until after
199 creation of root handle so that the fluids are GC protected. Also
200 removed the critical section.
201
c4c52ebe
MD
2022002-12-10 Mikael Djurfeldt <mdj@kvast.blakulla.net>
203
960c408c
MD
204 * gc-malloc.c, gc.h (scm_gc_malloc_prehistory): New function.
205
3cdde9d6 206 * gc-malloc.c (malloc_mutex): New mutex.
960c408c 207 (scm_gc_malloc_prehistory): Initialize it.
3cdde9d6
MD
208 (scm_realloc): Serialize call to realloc
209 (scm_calloc): Same for calloc.
210 Thanks to Wolfgang Jaehrling!
211 (Now we have to make sure all calls to malloc/realloc are made
212 through scm_malloc.)
213
960c408c
MD
214 * init.c (scm_init_guile_1): Call scm_gc_malloc_prehistory.
215
c4c52ebe
MD
216 * threads.c (really_launch): Release heap (to prevent deadlock).
217 (create_thread): Release heap before locking thread admin mutex.
218
b0dc3d71
MD
2192002-12-10 Mikael Djurfeldt <mdj@kvast.blakulla.net>
220
221 * threads.c (scm_i_thread_invalidate_freelists): New
222 function.
223
224 * gc.c (scm_igc): Call scm_i_thread_invalidate_freelists.
225
226 * modules.c (scm_export): Inserted a return statement.
227
06e80f59
HWN
2282002-12-10 Han-Wen Nienhuys <hanwen@cs.uu.nl>
229
230 * modules.c (scm_export): new function
231
232 * gc-card.c: add a note about malloc()/free() overhead.
233
a12611c3
MD
2342002-12-10 Mikael Djurfeldt <mdj@kvast.blakulla.net>
235
236 * Makefile.am (c-tokenize.$(OBJEXT)): Don't look for c-tokenize.c
237 in srcdir.
238
c7fabadf
MD
2392002-12-10 Mikael Djurfeldt <djurfeldt@nada.kth.se>
240
241 These changes remove scm_ints_disabled (which hasn't has any
242 effect in Guile for quite some time).
243
244 * async.c, error.h (scm_ints_disabled): Removed.
245
246 * gc.c (scm_gc_for_newcell), init.c (scm_init_guile_1),
247 root.c (scm_internal_cwdr), gdbint.c (SCM_BEGIN_FOREIGN_BLOCK,
248 SCM_END_FOREIGN_BLOCK): Don't touch scm_ints_disabled.
249 (old_ints): Removed.
250
251 * __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): Define as a recursive
252 critical section.
253 (SCM_REDEFER_INTS, SCM_ALLOW_INTS): Define as SCM_DEFER_INTS and
254 SCM_ALLOW_INTS.
255
9bc4701c
MD
2562002-12-09 Mikael Djurfeldt <djurfeldt@nada.kth.se>
257
52340b65
MD
258 * threads.c (scm_mutex_lock, scm_cond_wait, scm_cond_timedwait):
259 Removed accidental #if 0 around these functions.
260
9bc4701c
MD
261 These changes are the start of support for preemptive
262 multithreading. Marius and I have agreed that I commit this code
263 into the repository although it isn't thoroughly tested and surely
264 introduces many bugs. The bugs should only be exposed when using
265 threads, though. Signalling and error handling for threads is
266 very likely broken. Work on making the implementation cleaner and
267 more efficient is needed.
268
269 * __scm.h (SCM_ALLOW_INTS_ONLY): Removed.
270 (SCM_NONREC_CRITICAL_SECTION_START,
271 SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
272 SCM_REC_CRITICAL_SECTION_END): New macros.
273 (SCM_CRITICAL_SECTION_START/END): Defined here.
274
275 * eval.c: Insert SOURCE_SECTION_START / SOURCE_SECTION_END around
276 the three calls to scm_m_expand_body.
277
278 * gc.h: #include "libguile/pthread-threads.h";
279 (SCM_FREELIST_CREATE, SCM_FREELIST_LOC): New macros.
280
281 * gc.c (scm_i_freelist, scm_i_freelist2): Defined to be of type
282 scm_t_key;
283
284 * gc.c, gc-freelist.c, inline.h: Use SCM_FREELIST_LOC for freelist
285 access.
286
287 * gc-freelist.c (scm_gc_init_freelist): Create freelist keys.
288
289 * gc-freelist.c, threads.c (really_launch): Use
290 SCM_FREELIST_CREATE.
291
292 * gc-malloc.c (scm_realloc, scm_gc_register_collectable_memory):
293
294 * gc.c (scm_i_expensive_validation_check, scm_gc,
295 scm_gc_for_newcell): Put threads to sleep before doing GC-related
296 heap administration so that those pieces of code are executed
297 single-threaded. We might consider rewriting these code sections
298 in terms of a "call_gc_code_singly_threaded" construct instead of
299 calling the pair of scm_i_thread_put_to_sleep () and
300 scm_i_thread_wake_up (). Also, we would want to have as many of
301 these sections eleminated.
302
303 * init.c (scm_init_guile_1): Call scm_threads_prehistory.
304
305 * inline.h: #include "libguile/threads.h"
306
307 * pthread-threads.h: Macros now conform more closely to the
308 pthreads interface. Some of them now take a second argument.
309
310 * threads.c, threads.h: Many changes.
311
3122002-12-09 Mikael Djurfeldt <djurfeldt@nada.kth.se>
313
314 * Makefile.am (version.h): Changed $^ --> $< in rule for
315 version.h.
316
b2cbe8d8
RB
3172002-12-08 Rob Browning <rlb@defaultvalue.org>
318
319 * version.h.in (SCM_MICRO_VERSION): use @--@ substitution now.
320 (SCM_MINOR_VERSION): use @--@ substitution now.
321 (SCM_MICRO_VERSION): use @--@ substitution now.
322 (scm_effective_version): new function prototype.
323
324 * version.c (scm_effective_version): new function, also add
325 effective-version.
326
327 * Makefile.am (schemelibdir): VERSION -> GUILE_EFFECTIVE_VERSION.
328 (libpath.h): use GUILE_EFFECTIVE_VERSION to compute
329 SCM_LIBRARY_DIR.
330 (version.h): generate this here rather than configure.in. This
331 approach tracks source edits better (i.e. more immediately).
332 Might be worth considering for other .in files too.
333
5441c65c
MV
3342002-12-02 Marius Vollmer <mvo@zagadka.ping.de>
335
336 Reorganized thread package selection. A thread package now only
337 implements a small set of pthread like functions and Guile
338 implements the rest on top of that. Guile's implementation is
339 what the "coop-pthreads" package has been previously. Support for
340 "coop" threads has been removed until I get time to add it again.
341
342 * Makefile.am (libguile_la_SOURCES): Removed iselect.c.
343 (noinst_HEADERS): Removed coop-threads.c, coop-threads.h, coop.c,
344 null-threads.c, coop-pthreads.c.
345 (modinclude_HEADERS): Removed coop-defs.h, coop-pthreads.h. Added
346 pthread-threads.h.
347
348 * validate.h (SCM_VALIDATE_THREAD): Moved to threads.h.
349
350 * threads.h: Do not include "libguile/coop-defs.h". Include
351 "libguile/pthread-threads.h" for USE_COPT_THREADS. Removed
352 (previously deprecated) C level thread API prototypes. They are
353 now in the thread package specific headers, "null-threads.h" and
354 "pthread-threads.h".
355 (SCM_VALIDATE_THREAD, SCM_VALIDATE_MUTEX, SCM_VALIDATE_CONDVAR):
356 New.
357 (scm_threads_init): Removed.
358 (SCM_CRITICAL_SECTION_START, SCM_CRITICAL_SECTION_END,
359 SCM_THREAD_SWITCHING_CODE, scm_i_switch_counter,
360 SCM_I_THREAD_SWITCH_COUNT): Define here.
361 (scm_single_thread_p): Removed.
362 (scm_call_with_new_thread): Take two args directly instead of list
363 of two args.
364 (scm_i_thread_data, scm_i_set_thread_data, SCM_THREAD_LOCAL_DATA,
365 SCM_SET_THREAD_LOCAL_DATA): Define here.
366
367 * threads.c: Merged with "coop-pthreads.c".
368
369 * null-threads.h: Implement pthread-like API as a set of macros.
370
371 * pthread-threads.h: New, implement pthread-like API by deferring
372 to pthread itself.
373
374 * init.c (scm_init_guile_1): Do not call scm_init_iselect, which
375 has been lost in the reorganization.
376
504d99c5
MD
3772002-12-01 Mikael Djurfeldt <mdj@linnaeus>
378
379 The following change makes it possible to move procedure
380 application dispatch outside inner loops. The motivation was
381 clean implementation of efficient replacements of R5RS primitives
382 in SRFI-1.
383
384 The semantics is clear: scm_trampoline_N returns an optimized
385 version of scm_call_N (or NULL if the procedure isn't applicable
386 on N args).
387
388 Applying the optimization to map and for-each increases efficiency
389 noticeably. For example, (map abs ls) is 8 times faster than
390 before.
391
392 * eval.h (scm_t_trampoline_1, scm_t_trampoline_2): New types.
393
394 * eval.c, eval.h (scm_trampoline_1, scm_trampoline_2): New functions.
395
396 * eval.c (call_subr2_2, call_lsubr_2, call_closure_2): New functions;
397 (map, for-each): Handle also application on two args as a special
398 case; Use trampolines.
399
400 Other changes:
401
402 * sort.c (scm_cmp_function): Choose subr2less for scm_tc7_subr_2o;
403 (subr2oless): Removed.
404 (scm_restricted_vector_sort_x): Use scm_return_first to keep the
405 vector GC protected.
406
407 * eval.c (check_map_args): Use scm_out_of_range_pos instead of
408 scm_out_of_range.
409
63dd3413
DH
4102002-11-24 Dirk Herrmann <D.Herrmann@tu-bs.de>
411
412 * evalext.[ch] (scm_m_undefine, undefine): Deprecated.
413
4ba5f279
MD
4142002-11-17 Mikael Djurfeldt <mdj@linnaeus>
415
416 * debug.c (scm_make_iloc): Added missing "return".
417
56ae231f
MV
4182002-11-17 Marius Vollmer <mvo@zagadka.ping.de>
419
420 * strports.c (scm_eval_string_in_module): Validate second arg to
421 be a module. Thanks to Arno Peters!
422
80b28865
DH
4232002-11-16 Dirk Herrmann <D.Herrmann@tu-bs.de>
424
425 * .cvsignore: remove goops.c
426
c88b1456
DH
4272002-11-16 Dirk Herrmann <D.Herrmann@tu-bs.de>
428
429 * modules.c (scm_env_top_level, scm_lookup_closure_module,
430 module_variable, scm_module_lookup_closure,
431 scm_module_transformer, scm_sym2var, scm_module_reverse_lookup,
432 scm_system_module_env_p): Don't compare SCM values with C
433 operators == or !=. Avoid SCM_IMP predicates. Prefer !SCM_FALSEP
434 over SCM_NFALSEP.
435
a8a19efc
DH
4362002-11-16 Dirk Herrmann <D.Herrmann@tu-bs.de>
437
438 * eval.h (SCM_MAKE_ILOC): New macro.
439
440 * debug.c (scm_make_iloc): Use SCM_MAKE_ILOC instead of computing
441 the iloc bitpattern here.
442
76734914
MD
4432002-11-14 Mikael Djurfeldt <mdj@linnaeus>
444
445 * coop-pthreads.c, coop-pthreads.h: scm_internal_select should be
446 part of the API, otherwise it's difficult to write Guile
447 extensions using non-blocking I/O => moved #include
448 "libguile/iselect.h" from coop-pthreads.c --> coop-pthreads.h.
449
450 * coop-pthreads.c (scm_unlock_mutex): Changed s_lock_mutex -->
451 s_unlock_mutex.
452
8b5b4a75
MV
4532002-11-10 Marius Vollmer <mvo@zagadka.ping.de>
454
455 * __scm.h (USE_THREADS, GUILE_ISELECT): Do not define here. They
456 are defined in configure.in.
457
458 * threads.c: Removed SCM_API from function definitions. SCM_API
459 is only for declarations.
460
e5a83084
MD
4612002-11-07 Mikael Djurfeldt <mdj@linnaeus>
462
9be8bb45
MD
463 * coop-pthreads.h: Added support for thread specific data to the
464 generic C API for the coop-pthreads case.
465
e5a83084
MD
466 * threads.c, threads.h (scm_cond_init): Undo unintentional API
467 change.
6c214b62 468 (scm_cond_broadcast): Added missing function.
e5a83084 469
7edf178e
MV
4702002-11-04 Marius Vollmer <marius.vollmer@uni-dortmund.de>
471
472 * coop.c (coop_next_runnable_thread): Removed, wich should have
473 happened when GUILE_ISELECT was hard-wired.
474
7f5b1b77
MV
4752002-11-03 Marius Vollmer <mvo@zagadka.ping.de>
476
7caa1b07
MV
477 * Makefile.am (libguile_la_SOURCES): Added threads.c
478 (DOT_DOC_FILES): Added threads.doc.
479 (DOT_X_FILES): Added threads.x.
480 (EXTRA_libguile_la_SOURCES): Removed threads.c.
481 (noinst_HEADERS): Added coop-pthreads.c.
482 (modinclude_HEADERS): Added coop-pthreads.h.
483
484 * __scm.h (USE_THREADS, GUILE_ISELECT): Define when
485 SCM_DEBUG_DEPRECATED. Removed their use thru-out Guile.
486
bb11cbf4
MV
487 * iselect.c: Include "_scm.h" before testing HAVE_UNISTD_H.
488 Thanks to Bill Schottstaedt!
489
1d4cbbed
MV
490 * numbers.c (scm_integer_expt): Make 0^z == 0 for z != 0.
491
7f5b1b77
MV
492 * _scm.h (HAVE_RESTARTABLE_SYSCALLS): Do define even when
493 SCM_COPT_THREADS is defined.
494 (SCM_SYSCALL): Use EINTR-expection version when SCM_COPT_THREADS
495 is defined.
496
497 * coop-pthreads.c: Some harmless renamings of internal stuff.
498 (create_thread): New, generalized version of
499 scm_call_with_new_thread.
500 (scm_call_with_new_thread): Use it.
501 (scm_spawn_thread): New, use create_thread.
502
d52f53b1
MV
5032002-11-02 Marius Vollmer <mvo@zagadka.ping.de>
504
505 * coop-pthreads.c, coop-pthreads.h: Redone completely, you might
506 start testing it now.
507
508 * _scm.h: Include <errno.h< so that SCM_SYSCALL is correctly
509 defined when HAVE_RESTARTABLE_SYSCALLS is not defined.
510 (HAVE_RESTARTABLE_SYSCALLS): Do not define when USE_COPT_THREADS
511 is defined.
512
30f920c3
MV
5132002-10-27 Marius Vollmer <mvo@zagadka.ping.de>
514
515 * scmsigs.c (signal_cell_handlers, install_handler_data,
516 scm_delq_spine_x, really_install_handler, install_handler): New
517 scheme for triggering signal handlers, to simplify take_signal.
518 (take_signal): Simplified, to avoid race conditions.
519 (scm_sigaction_for_thread): Use new Scheme. Validate that thread
520 hasn't exited yet.
521
522 * async.c (scm_async_click): Reset pending_asyncs, handle
523 signal_asyncs. Don't set cdr of a non-signal async to #f.
524 (scm_i_queue_async_cell): Do not check cdr of cell for #f, queue
525 always. Set pending_asyncs.
526 (scm_system_async_mark_for_thread): Check that thread has not
527 exited.
528 (scm_unmask_signals, decrease_block): Call scm_async_click after
529 block_asyncs becomes zero.
530
531 * __scm.h (SCM_ASYNC_CLICK): Check pending_asyncs instead of
532 active_asyncs.
533
534 * root.h (scm_root_state): Added pending_asyncs and signal_asyncs
535 fields.
536 * root.c (root_mark): Mark them.
537 (make_root): Initialize them.
538
539 * iselect.c, iselect.h: Replaced GUILE_ISELECT with
540 USE_COOP_THREADS.
541 (scm_internal_select): Define one version for USE_COOP_THREADS and
542 one for USE_NULL_THREADS.
543 (scm_init_iselect): Likewise.
544
545 * inline.h (scm_cell, scm_double_cell): Also allow
546 USE_COPT_THREADS to not protect the slot initializers.
547
548 * init.c (scm_init_guile_1): Call scm_init_thread_procs. This is
549 because threads need to be initialized before the stack, but
550 gsubrs such as scm_timed_condition_variable_wait can only be
551 created later.
552
553 * threads.h: Include "coop-pthreads.h" when requested.
554 (scm_threads_make_mutex, scm_threads_lock_mutex,
555 scm_threads_unlock_mutex, scm_threads_monitor): Removed, they were
556 not implemented anyway.
557 (scm_init_thread_procs, scm_try_mutex,
558 scm_timed_condition_variable_wait,
559 scm_broadcast_condition_variable, scm_c_thread_exited_p,
560 scm_thread_exited_p): New prototypes.
561 (struct timespec): Define if not already defined.
562 (scm_t_mutex, scm_mutex_init, scm_mutex_lock, scm_mutex_trylock,
563 scm_mutex_unlock, scm_mutex_destroy, scm_t_cond, scm_cond_init,
564 scm_cond_wait, scm_cond_timedwait, scm_cond_signal,
565 scm_cond_broadcast, scm_cond_destroy): Declarations moved here and
566 deprecated.
567
568 * threads.c: Include <errno.h>. Include "coop-pthreads.c" when
569 requested.
570 (scm_thread_exited_p): New.
571 (scm_try_mutex, scm_broadcast_condition_variable): Newly
572 registered procedures.
573 (scm_wait_condition_variable, scm_timed_wait_condition_variable):
574 Use the latter as the procedure for "wait-condition-variable",
575 thus offering a optional timeout parameter to Scheme.
576 (scm_wait_condition_variable): Implement in terms of
577 scm_timed_wait_condition_variable.
578 (scm_mutex_init, scm_mutex_lock, scm_mutex_trylock,
579 scm_mutex_unlock, scm_mutex_destroy, scm_cond_init,
580 scm_cond_wait, scm_cond_timedwait, scm_cond_signal,
581 scm_cond_broadcast, scm_cond_destroy): Implement in terms of
582 scm_make_mutex, etc, and deprecate.
583 (scm_init_threads): Do not create smobs, leave this to
584 scm_threads_init. Do not include "threads.x" file.
585 (scm_init_thread_procs): New, include "threads.x" here.
586
587 * null-threads.h (scm_null_mutex, scm_null_mutex_init,
588 scm_null_mutex_lock, scm_null_mutex_unlock,
589 scm_null_mutex_destroy, scm_null_condvar, scm_null_condvar_init,
590 scm_null_condvar_wait, scm_null_condvar_signal,
591 scm_null_condvar_destroy): Removed.
592 (scm_mutex_init, scm_mutex_lock, scm_mutex_unlock, scm_cond_init,
593 scm_cond_wait, scm_cond_signal, scm_cond_broadcast,
594 scm_cond_destory): Do not define, they are now deprecated and
595 handled by threads.{h,c}.
596
597 * null-threads.c (scm_null_mutex, scm_null_cond): Define here.
598 (scm_threads_init): Create smobs here, using the appropriate
599 sizes.
600 (block): Removed, now unused.
601 (scm_c_thread_exited_p): New.
602 (scm_null_mutex_init, scm_null_mutex_lock, scm_null_mutex_unlock,
603 scm_null_mutex_destroy, scm_null_condvar_init,
604 scm_null_condvar_wait, scm_null_condvar_signal,
605 scm_null_condvar_destroy): Removed and updated users to do their
606 task directly.
607 (scm_try_mutex, timeval_subtract,
608 scm_timed_wait_condition_variable,
609 scm_broadcast_condition_variable): New.
610 (scm_wait_condition_variable): Removed.
611
612 * coop-defs.h (coop_m): Added 'level' field.
613 (scm_t_mutex, scm_mutex_init, scm_mutex_lock, scm_mutex_trylock,
614 scm_mutex_unlock, scm_mutex_destroy, scm_t_cond, scm_cond_init,
615 scm_cond_wait, scm_cond_timedwait, scm_cond_signal,
616 scm_cond_broadcast, scm_cond_destroy, struct timespec): Do not
617 define.
618 (coop_condition_variable_broadcast): New.
619
620 * coop-threads.c (scm_threads_init): Create smobs here, using the
621 appropriate sizes.
622 (scm_c_thread_exited_p, scm_try_mutex,
623 scm_timed_wait_condition_variable,
624 scm_broadcast_condition_variable): New.
625 (scm_wait_condition_variable): Removed.
626
627 * coop.c (coop_new_mutex_init): Initialize level.
628 (coop_mutex_trylock, coop_mutex_lock, coop_mutex_unlock): maintain
629 level.
630 (coop_condition_variable_signal): Renamed to
631 coop_condition_variable_broadcast and reimplemented in terms of
632 that. Thus...
633 (coop_condition_variable_broadcast): New.
634
635 * goops.c (hell_mutex): Reimplemented using scm_make_mutex, etc.
636
637 * coop-pthreads.h, coop-pthreads.c: New, but unfinished.
638
087ed40d
MV
6392002-10-21 Marius Vollmer <mvo@zagadka.ping.de>
640
65a23095
MV
641 * null-threads.c: Include <time.h>. Also, use <...> for inclusion
642 of system headers.
643
087ed40d
MV
644 * async.c, goops.h, modules.h, validate.h (SCM_MAKE_VALIDATE_MSG):
645 New. Use it instead of SCM_MAKE_VALIDATE in lots of places to
30f920c3 646 give better error messages. Thanks to Bill Schottstaedt!
087ed40d 647
5ec1d2c8
DH
6482002-10-19 Dirk Herrmann <D.Herrmann@tu-bs.de>
649
650 * evalext.h, evalext.c (scm_definedp, scm_defined_p): Renamed
651 scm_definedp to scm_defined_p and deprecated scm_definedp.
652
100ae50d
DH
6532002-10-19 Dirk Herrmann <D.Herrmann@tu-bs.de>
654
655 * async.h, async.c (scm_system_async): Fixed deprecation to work
656 correctly when deprecated features are excluded.
657
2794cb50
MV
6582002-10-16 Marius Vollmer <marius.vollmer@uni-dortmund.de>
659
660 * async.c (scm_system_async_mark_for_thread): Validate thread
661 argument.
662
663 * coop-threads.c (scm_i_thread_root): Do not validate argument.
664
665 * feature.c (scm_init_feature): Don't add 'threads' for
666 USE_NULL_THREADS.
667
668 * inline.h (scm_cell, scm_double_cell): Also allow
669 USE_NULL_THREADS to not protect the slot initializers.
670
671 * scmsigs.c (scm_sigaction_for_thread): It's "USE_THREADS" not
672 "USE_THREAD".
673
674 * Makefile.am (noinst_HEADERS): Added null-threads.c.
675 (modinclude_HEADERS): Added null-threads.h.
676
677 * threads.h: Include null-threads.h when !USE_COOP_THREADS.
678 * threads.c: Include null-threads.c when !USE_COOP_THREADS.
679 (scm_init_threads): Use generic type names scm_t_mutex and
680 scm_t_cond instead of coop_m and coop_c.
681
682 * null-threads.c, null-threads.h: New files.
683
ff810d7a
MV
6842002-10-15 Marius Vollmer <mvo@zagadka.ping.de>
685
686 * Makefile.am: Replaced "$<" in non-pattern rules with its value.
687 This is to support makes that know about "$<" only in pattern
688 rules, like Sun's make.
689
a90bdb73
MV
6902002-10-13 Marius Vollmer <mvo@zagadka.ping.de>
691
692 * Makefile.am (libpath.h): Fixed typo in top_srcdir_absolute
693 substitution. Thanks to David Allouche!
694
e71a8bf2
DH
6952002-10-13 Dirk Herrmann <D.Herrmann@tu-bs.de>
696
697 * evalext.h: Replaced SCM_DEBUG_DEPRECATED with
698 !SCM_ENABLE_DEPRECATED.
699
41f77ff5
MV
7002002-10-11 Marius Vollmer <marius.vollmer@uni-dortmund.de>
701
504d99c5 702 * async.c (scm_system_async_mark_for_thread): Only call
41f77ff5
MV
703 scm_i_thread_root when USE_THREADS is defined. Use scm_root
704 otherwise.
705
706 * scmsigs.c (take_signal): Only call scm_i_thread_root when
707 USE_THREADS is defined. Use scm_root otherwise.
708 (scm_sigaction_for_thread): Ignore THREAD argument when
709 USE_THREADS is not defined. Also, move THREAD argument defaulting
710 out of HAVE_SIGACTION section, which was a bug.
711
6d16b125
MV
7122002-10-10 Marius Vollmer <marius.vollmer@uni-dortmund.de>
713
714 * scmsigs.c (scm_sigaction_for_thread): Store original handler in
715 signal_handlers, not the closure that is used as the async.
716 The closure is stored in signal_handler_cells, as previously.
717
acfa1f52
MV
7182002-10-10 Marius Vollmer <mvo@zagadka.ping.de>
719
720 * root.h (scm_root_state): Added 'block_async' slot.
721 (scm_active_asyncs): Removed abbrev.
722 * root.c (scm_make_root): Initialize 'block_asyncs' slot.
723
724 * __scm.h (SCM_ASYNC_TICK): Do without the scm_active_asyncs
725 abbrev.
726
727 * async.h (scm_call_with_blocked_asyncs,
728 scm_call_with_unblocked_asyncs, scm_c_call_with_blocked_asyncs,
729 scm_c_call_with_unblocked_asyncs): New prototypes.
730 (scm_mask_signals, scm_unmask_signals): Deprecated.
731 (scm_mask_ints): Turned into a macro.
732 * async.c (scm_mask_ints): Removed.
733 (scm_run_asyncs): Do not set scm_mask_ints while running an async.
734 this should not be necessary.
735 (scm_async_click): Test block_asyncs instead of scm_mask_ints.
736 (scm_mask_signals, scm_unmask_signals): Deprecated. Emit
737 deprecation warning and check for errornous use. Set block_asyncs
738 instead of scm_mask_ints.
739 (increase_block, decrease_block, scm_call_with_blocked_asyncs,
740 scm_call_with_unblocked_asyncs, scm_c_call_with_blocked_asyncs,
741 scm_c_call_with_unblocked_asyncs): New.
742
743 * script.c (scm_compile_shell_switches): Do not set scm_mask_ints.
744 Asyncs are enabled by default.
745
34010f56
NJ
7462002-10-09 Neil Jerram <neil@ossau.uklinux.net>
747
748 * vports.c (scm_make_soft_port): Allow vector argument to carry a
749 6th element: an input waiting thunk.
750 (sf_input_waiting): New.
751
9310d6f2
MV
7522002-10-05 Marius Vollmer <mvo@zagadka.ping.de>
753
754 * root.c (root_mark): Mark active_asyncs slot.
755
756 * async.c (scm_async_click): Set the cdr of a executed handler
757 cell to SCM_BOOL_F, not SCM_EOL.
758 (scm_i_queue_async_cell): Queue the cell at the end of the list,
759 and only if the handler procedure is not already present.
760 (scm_system_async_mark_for_thread): Initialize cdr of handler cell
761 with SCM_BOOL_F.
762 * scmsigs.c (scm_sigaction_for_thread): Likewise.
763
ac48c719
RB
7642002-10-04 Rob Browning <rlb@defaultvalue.org>
765
1360a142
RB
766 * guile.c (main): switch to scm_lt_dlset_preloaded_symbols;
767
768 * dynl.c (sysdep_dynl_link): switch to scm_lt_dlhandle,
769 scm_lt_dlopenext, and scm_lt_dlerror.
770 (sysdep_dynl_unlink): switch to scm_lt_dlhandle, scm_lt_dlclose,
771 and scm_lt_dlerror.
772 (sysdep_dynl_func): switch to scm_lt_dlhandle, scm_lt_dlsym,
773 and scm_lt_dlerror.
774 (sysdep_dynl_init): switch to scm_lt_dlinit();
775
776 * Makefile.am (libguile_la_LIBADD): switch to use
777 libguile-ltdl.la.
778
504d99c5 779 * numbers.c (scm_integer_expt): (expt 0 1) should be 1.
ac48c719 780
497092c9
MV
7812002-10-04 Marius Vollmer <mvo@zagadka.ping.de>
782
783 * scmsigs.h (scm_sigaction_for_thread): New prototype.
784 * scmsigs.c (got_signal): Removed.
785 (signal_handler_cells, signal_handler_threads): New.
786 (take_signal): Queue the cell of the signal for the specified
787 thread. Reset the signal handler on systems that don't have
788 sigaction.
789 (sys_deliver_signals): Removed.
790 (close_1): New.
791 (scm_sigaction_for_thread): Renamed from scm_sigaction and
792 extended to also set the thread of a signal and allocate a cell
793 for it. Keep the Scheme name "sigaction". Check that signum is
794 within range. Also, use SCM_VECTOR_REF instead of SCM_VELTS.
795 (scm_sigaction): Implement in terms of scm_sigaction_for_thread.
796 (scm_init_scmsigs): Allocate signal_handler_cells and
797 signal_handler_threads vectors.
798
799 * async.c: Removed GUILE_OLD_ASYNC_CLICK code. Reorganized so
800 that system asnycs and user asyncs are separated. Reimplemented
801 system asyncs to work per-thread.
802
803 * gc.c (scm_init_gc): Do not use scm_system_async.
804
805 * async.h (scm_asyncs_pending, scm_set_tick_rate,
806 scm_set_switch_rate, scm_system_async_mark_from_signal_handler):
807 Removed prototypes.
808 (scm_i_queue_async_cell): New.
809
810 * __scm.h (scm_asyncs_pending_p): Removed.
811 (SCM_ASYNC_CLICK): Check scm_active_asyncs instead of
812 scm_asyncs_pending_p.
813
814 * async.h (scm_system_async_mark_for_thread): New prototype.
815
816 * __scm.h: Removed GUILE_OLD_ASYNC_CLICK code.
817
818 * root.h (scm_root_state): Added new "active_asyncs" slot.
819 * root.c (scm_make_root): Initialize it to SCM_EOL.
820
821 * coop-defs.h (coop_t): Added new "handle" slot.
822 * coop-threads.c (all_threads, scm_current_thread,
823 scm_all_threads, scm_i_thread_root): New.
824 (scm_threads_init): Add main thread to all_threads.
825 (scheme_launch_thread): Remove thread from all_threads when it
826 terminates.
827 (scm_call_with_new_thread): Initialize handle slot of coop_t
828 structure and add new thread to all_threads.
829 (scm_spawn_thread): Likewise.
830
831 * threads.h (scm_current_thread, scm_all_threads): New prototypes.
832 * threads.c (scm_current_thread, scm_all_threads): Register as
833 primitives.
834
835 * dynl.c: Use scm_lt_ prefix for libltdl functions.
836
480fa28d
NJ
8372002-09-29 Neil Jerram <neil@ossau.uklinux.net>
838
839 * script.c (scm_compile_shell_switches): Fix bad spelling of
840 `explicitly' in comment.
841
8422002-09-28 Neil Jerram <neil@ossau.uklinux.net>
843
844 * posix.c (scm_geteuid, scm_getegid, scm_seteuid, scm_setegid):
845 Refer to provided? in doc string rather than deprecated feature?.
846
3553e1d1
GH
8472002-09-24 Gary Houston <ghouston@arglist.com>
848
849 * inline.h (scm_double_cell): prevent reordering of statements
850 with any following code (for GCC 3 strict-aliasing).
851 * numbers.c (scm_make_real), num2float.i.c (FLOAT2NUM): removed
852 the earlier version of the reordering prevention.
853
4ad0814a
HWN
8542002-09-19 Han-Wen Nienhuys <hanwen@cs.uu.nl>
855
856 * inline.h (scm_double_cell): move SET_GCMARK set out of if body.
857
e88e4f2e
HWN
8582002-09-09 Han-Wen Nienhuys <hanwen@cs.uu.nl>
859
860 * gc-malloc.c (scm_gc_register_collectable_memory): more overflow
861 protection.
862
1e71eafb
HWN
8632002-09-08 Han-Wen Nienhuys <hanwen@cs.uu.nl>
864
865 * inline.h: include stdio.h
866
867 * smob.c (free_print): abort if scm_debug_cell_accesses_p is set
868
61ef9c1f
HWN
8692002-09-05 Han-Wen Nienhuys <hanwen@cs.uu.nl>
870
dac04e9f
HWN
871 * gc-segment.c (scm_i_make_initial_segment): check user settings
872 for sanity.
873
874 * gc-malloc.c (scm_gc_init_malloc): check user settings for
875 sanity.
dac04e9f
HWN
876
877 * gc-freelist.c (scm_init_freelist): check user settings for sanity.
878
ffd72400
HWN
879 * struct.h: change scm_structs_to_free to scm_i_structs_to_free
880
881 * gc-malloc.c (scm_gc_register_collectable_memory): use floats;
1e71eafb
HWN
882 these won't ever wrap around with high memory usage. Thanks to
883 Sven Hartrumpf for finding this.
ffd72400 884
5bd4a949
HWN
885 * gc-freelist.c: include <stdio.h>
886
61ef9c1f
HWN
887 * gc-malloc.c: add DEBUGINFO for mtrigger GCs.
888
ffd0ef3b
MV
8892002-09-01 Marius Vollmer <mvo@zagadka.ping.de>
890
a27e3d14
MV
891 * vectors.h (SCM_VECTOR_REF): New.
892
ffd0ef3b
MV
893 * snarf.h (SCM_DEFINE_PUBLIC): New.
894
f8a1712b
MV
8952002-08-30 Marius Vollmer <mvo@zagadka.ping.de>
896
897 * socket.c (scm_addr_vector): Added size of address to arguments.
898 Use it to avoid accessing a non-existent path in a sockaddr_un.
899 Changed all callers.
900
7200a36b
HWN
9012002-08-29 Han-Wen Nienhuys <hanwen@cs.uu.nl>
902
1383773b
HWN
903 * gc.h: remove DOUBLECELL card flags.
904
905 * gc-malloc.c (scm_calloc): try to use calloc() before calling
906 scm_realloc().
907
908 * gc-segment.c (scm_i_initialize_heap_segment_data): remove card
909 init loop; handle this from scm_init_card_freelist()
910
911 * gc-card.c (scm_init_card_freelist): init bit vector here.
912
7200a36b 913 * numbers.c (scm_make_real): prevent reordering of statements
8fa5786d 914 num2float.i.c (FLOAT2NUM): idem
7200a36b 915
9981de3a
HWN
9162002-08-27 Han-Wen Nienhuys <hanwen@cs.uu.nl>
917
918 * eval.h: prepend libguile/ to include path
919
19647556
MV
9202002-08-26 Marius Vollmer <mvo@zagadka.ping.de>
921
922 * script.c (scm_compile_shell_switches): Added "2002" to Copyright
923