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