malloc.
* gc-segment.c (scm_i_get_new_heap_segment): remove cluster cruft:
only use SCM_MIN_HEAP_SEG_SIZE.
* ports.c (scm_add_to_port_table): add backwards compatibility
function
* ports.h: use scm_i_ prefix for port table and port table size.
* NEWS: Corrected remarks about SCM_API.
* configure.in: Defining USE_DLL_IMPORT definition to indicate
usage of DLL import macros in `libguile/__scm.h'.
(LIBOBJS): Removed `fileblocks.o' from the list of object files.
Somehow Jim Blandy's patch from 1997 did not survive.
2001-11-04 Stefan Jahn <stefan@lkcc.org>
* configure.in (EXTRA_DEFS): Follow-up patch. Using SCM_IMPORT
instead of __SCM_IMPORT__.
* readline.c (scm_readline_init_ports): Disable input/output
stream redirection for Win32. The readline package for Win32
does not support this. The guile-readline library works fine
for command line editing.
* readline.h (SCM_RL_API): Renamed __FOO__ macros into FOO.
2001-11-04 Stefan Jahn <stefan@lkcc.org>
* Makefile.am (libguile_la_LIBADD): Added $(THREAD_LIBS_LOCAL)
here (was at guile_LDADD) which describes the dependency
correctly and allows a clean build on Win32.
* __scm.h (SCM_API): Follow-up patch. Renamed __FOO__ macros
into FOO.
* __scm.h: USE_DLL_IMPORT indicates the usage of the DLL
import macros for external libraries (libcrypt, libqthreads,
libreadline and libregex).
* coop-defs.h: Include <winsock2.h> for `struct timeval'.
* posix.c (flock): Added support for flock() in M$-Windows.
* guile.c (SCM_IMPORT): Follow-up patch. Use SCM_IMPORT instead
of __SCM_IMPORT__.
* fports.c (getflags): Differentiate reading and writing pipes
descriptors.
* filesys.c (S_IS*): Redefine all of the S_IS*() macros for
M$-Windows.
* coop.c (coop_condition_variable_timed_wait_mutex): Use
conditionalized error code if `ETIMEDOUT' is not available.
(scm_thread_usleep): Remove bogus declaration of `struct timeval
timeout'.
* numbers.c (PTRDIFF_MIN): Moved this definition where it actually
belongs. That is because NO_PREPRO_MAGIC gets undefined after
each inclusion of `num2integral.i.c'.
(SIZE_MAX): Define NO_PREPRO_MAGIC if SIZE_MAX is undefined.
2001-11-04 Stefan Jahn <stefan@lkcc.org>
* md/Makefile.am (EXTRA_DIST): Added `i386.asm'.
* md/i386.asm: New file. Contains the Intel syntax version for
nasm/tasm/masm of the file `i386.s'.
* qt.h.in: Definition of QT_API, QT_IMPORT and QT_EXPORT.
Prefixed each symbols which is meant to go into a DLL.
* Makefile.am (libqthreads_la_LDFLAGS): Put `-no-undefined'
into LDFLAGS to support linkers which do not allow unresolved
symbols inside shared libraries.
(EXTRA_DIST): Add `libqthreads.def', which is an export file
definition for M$-Windows. It defines exported symbols. This is
necessary because the M$VC linker does not know how to export
assembler symbols into a DLL.
2001-11-04 Stefan Jahn <stefan@lkcc.org>
* srfi-13.h, srfi-14.h, srfi-4.h: Follow-up patch. Renamed
__FOO__ macros into FOO.
2001-11-04 Stefan Jahn <stefan@lkcc.org>
* tests/ports.test: Run (close-port) before (delete-file) if
necessary/advisory.
(coop_create): Set mother_awake_p before creating or signalling
mother; wait until mother is going to sleep before returning.
(mother): Reset mother_awake_p before going to sleep.
and we don't want that.
(INCLUDES): Removed all -I options except for the root source
directory and the root build directory.
* *.*: Change includes so that they always use the "prefixes"
libguile/, qt/, guile-readline/, or libltdl/.
(Thanks to Tim Mooney.)
coop_mother, coop_child): New variables.
(mother): New function.
(coop_create): New thread spawning mechanism which uses a "mother
thread". The "dummy" pthreads aren't healthy enough to give birth
to new threads since Linux threads thinks they are asleep.
(coop_timeout_qinsert): Moved here from iselect.c
(coop_new_mutex_init, coop_new_condition_variable_init): New
functions. The strange names are temporary. Use scm_mutex_init
and scm_cond_init instead.
(coop_mutex_trylock): New function. Uses errno.h:EBUSY. errno.h
is ANSI C, but should we check for individual error codes in
configure.in?
(coop_condition_variable_timed_wait_mutex): New function.
(coop_key_create, coop_setspecific, coop_getspecific,
coop_key_delete,
prototypes; just use ANSI C prototypes. I'm not sure how
mit-pthreads.c ever compiled -- it still doesn't for me, but the
normal make procedure does not try to build it anyway (even
--with-threads I get the other threads code building) so I'm not
too worried about it.
(coop_condition_variable_wait_mutex): Folded logic of
coop_mutex_unlock into coop_condition_variable_wait_mutex to
prevent condvar signal lossage. Previously, another thread could
start to run after unlocking the mutex but before putting the
current thread on the wait queue. If that thread then would
signal the first, the signal would be lost. (Thanks to Christian
Lynbech.)
* coop.c (sleep, usleep): Remove declarations; we don't use or
redefine these any more.
(scm_thread_usleep, scm_thread_sleep): New functions which do the
job of usleep and sleep in a thread-friendly way. We can use
these in the rest of Guile. Define versions for systems both with
and without iselect.
* coop.c (scm_thread_sleep): Make `slept' an unsigned long.
* coop.c (coop_sleephelp): Remove ANSI #ifdef hair.
as does the return type. We really shouldn't be redefining usleep
at all, but I don't have time to clean that up before the 1.3.
release. It's on the schedule for afterwards. (Thanks to Julian
Satchell.)
* coop.c (usleep): Use USLEEP_ARG_TYPE in prototype and
definition.
* scmsigs.c (usleep): Use USLEEP_ARG_TYPE in prototype.
* scmconfig.h: Regenerated.
static. It's only useful internally --- you should never just
wait on a condition variable.
* coop-defs.h (coop_condition_variable_wait): Delete prototype.
* threads.h (scm_single_thread_p, scm_yield,
scm_call_with_new_thread, scm_join_thread, scm_make_mutex,
scm_lock_mutex, scm_unlock_mutex, scm_make_condition_variable,
scm_wait_condition_variable, scm_signal_condition_variable): Add
prototypes for these Scheme-visible functions.
* coop-defs.h (coop_next_runnable_thread,
coop_wait_for_runnable_thread_now, coop_wait_for_runnable_thread):
Prototypes for these here, even though they're from iselect.c.
(coop_condition_variable_wait, coop_join): Add prototypes.
* coop-threads.c (scm_threads_free_thread, scm_threads_free_mutex,
scm_threads_free_condvar): Make these smob functions static.
* coop-threads.h (coop_init): Give this a real prototype.
* coop.c: #include <unistd.h>, if we have it, for `usleep' and `sleep'.
(coop_next_runnable_thread): No need to provide prototype; it's in
coop-defs.h.
(scm_usleep): Return SCM_INUM0 on those systems.
* coop.c (usleep): Return void on some systems.
* configure.in: Define USLEEP_RETURNS_VOID on some systems.
interrupts masked, we can't use the old mechanism of delivering
signals immediately when they arrive. Signals must instead be
delivered when the asyncs run *after* the end of the critical
section in scm_internal_select. But this also means after context
switch so that the signal will be delivered to a different thread.
To avoid this, I have changed the protocol of
coop_wait_for_runnable_thread and friends so that they are allowed
to return the original thread. So, if a signal arrives during
scm_internal_select, we won't any longer be forced do a context
switch, but can remain in the same thread and deliver the signal
to it.
* coop.c (coop_mutex_init, coop_mutex_lock, coop_mutex_unlock,
coop_condition_variable_init, coop_condition_variable_wait,
coop_condition_variable_signal): Changed return type from `void'
to `int'. This is to adhere closer to the pthreads interface.
This, in turn, is part of an attempt to provide C versions of the
mutex and condition variable primitives which can be part of a
frontend to COOP or pthreads.
* coop.c (coop_mutex_destroy, coop_condition_variable_wait_mutex,
coop_condition_variable_destroy): New functions.
coop_condition_variable_init, coop_condition_variable_wait,
coop_condition_variable_signal): Changed return type from `void'
to `int'. This is to adhere closer to the pthreads interface.
This, in turn, is part of an attempt to provide C versions of the
mutex and condition variable primitives which can be part of a
frontend to COOP or pthreads.
* coop.c (coop_mutex_destroy, coop_condition_variable_wait_mutex,
coop_condition_variable_destroy): New functions.
* coop-threads.c (scm_wait_condition_variable): Use
coop_condition_variable_wait_mutex.
* coop-threads.h, coop-defs.h (coop_q_t, coop_m, coop_c):
Definitions moved to coop-defs.h.
* coop-defs.h (scm_mutex_init, scm_mutex_lock, scm_mutex_unlock,
scm_mutex_destroy, scm_cond_init, scm_cond_wait, scm_cond_signal,
scm_cond_destroy): New C interface to mutecis and cond vars.
* coop.c (coop_qinit): Initialize fields used by
scm_internal_select.
(coop_qget, coop_qget, coop_tmp_queue): Made global.
(coop_next_runnable_thread): If GUILE_ISELECT enabled, use
replacement in iselect.c.
(coop_mutex_lock, coop_condition_variable_wait, coop_abort,
coop_join): If GUILE_ISELECT enabled, use
coop_wait_for_runnable_thread instead of
coop_next_runnable_thread.
(usleep, sleep): New replacements for system functions if
GUILE_ISELECT is enabled.
* coop-threads.h: Declare coop_wait_for_runnable_thread.
* coop-defs.h (coop_t): Added fields used by scm_internal_select.
* filesys.c: Added #include "iselect.h". Moved FD-macros to
iselect.h. Implement Scheme level `select' using
scm_internal_select. (See NEWS.)
* genio.c (scm_getc): Block with scm_internal_select. (See NEWS.)
* init.c: Call scm_init_iselect.