1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

39 commits

Author SHA1 Message Date
Kevin Ryde
2b829bbb3d merge from 1.8 branch 2006-04-17 00:05:42 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Marius Vollmer
73be1d9e8e Changed license terms to the plain LGPL thru-out. 2003-04-05 19:15:35 +00:00
Rob Browning
e7dd0639de * coop.c: fix various preprocessor usages of new public
symbols to expect 0 or 1 values rather than 1 or undefined.
i.e. change #ifdef to #if, etc.
2003-03-27 20:06:17 +00:00
Rob Browning
fd291a5c13 * coop.c: replace usage of struct timespect with scm_t_timespec.
#include <config.h> if HAVE_CONFIG_H.
2003-03-25 23:54:01 +00:00
Marius Vollmer
79796da5b5 (coop_next_runnable_thread): Removed, wich should have happened when
GUILE_ISELECT was hard-wired.
2002-11-04 15:43:00 +00:00
Marius Vollmer
3d7f708f21 * __scm.h (USE_THREADS, GUILE_ISELECT): Define when
SCM_DEBUG_DEPRECATED.  Removed their use thru-out Guile.
2002-11-03 22:09:20 +00:00
Marius Vollmer
79cd5b8eda * coop-defs.h (coop_m): Added 'level' field.
(scm_t_mutex, scm_mutex_init, scm_mutex_lock, scm_mutex_trylock,
scm_mutex_unlock, scm_mutex_destroy, scm_t_cond, scm_cond_init,
scm_cond_wait, scm_cond_timedwait, scm_cond_signal,
scm_cond_broadcast, scm_cond_destroy, struct timespec): Do not
define.
(coop_condition_variable_broadcast): New.

* coop-threads.c (scm_threads_init): Create smobs here, using the
appropriate sizes.
(scm_c_thread_exited_p, scm_try_mutex,
scm_timed_wait_condition_variable,
scm_broadcast_condition_variable): New.
(scm_wait_condition_variable): Removed.

* coop.c (coop_new_mutex_init): Initialize level.
(coop_mutex_trylock, coop_mutex_lock, coop_mutex_unlock): maintain
level.
(coop_condition_variable_signal): Renamed to
coop_condition_variable_broadcast and reimplemented in terms of
that.  Thus...
(coop_condition_variable_broadcast): New.
2002-10-27 20:12:07 +00:00
Gary Houston
d900cd6dd4 * coop.c (coop_create): removed bogus 2nd argument in scm_malloc
call.
2002-08-17 20:39:35 +00:00
Han-Wen Nienhuys
67329a9eef * mallocs.c (scm_malloc_obj): use scm_gc_malloc in stead of
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.
2002-08-16 22:01:10 +00:00
Stefan Jahn
8f99e3f38b 2001-11-04 Stefan Jahn <stefan@lkcc.org>
* 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.
2001-11-04 15:52:30 +00:00
Mikael Djurfeldt
152812c057 * coop.c (mother_awake_p): New variable.
(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.
2001-10-06 16:30:20 +00:00
Mikael Djurfeldt
e75341b38d * coop.c: Inserted #include <stdio.h>.
* iselect.c: Reinserted #include <stdio.h>.
2001-03-10 03:09:07 +00:00
Dirk Herrmann
21e8f468cf * coop-threads.c: Don't join finished threads. Thanks to Julian Satchell.
* coop.c: Removed old non-working code.
2000-11-30 10:26:44 +00:00
Mikael Djurfeldt
a059974535 * Makefile.am (DEFS): Added. automake adds -I options to DEFS,
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.)
2000-04-21 14:16:44 +00:00
Mikael Djurfeldt
3da01fa367 *** empty log message *** 2000-04-10 12:38:19 +00:00
Mikael Djurfeldt
51523cd1f2 * coop.c (mother): Handled EINTR (the wait has been interrupted by
a signal).
2000-04-10 12:35:57 +00:00
Mikael Djurfeldt
6219b5eb41 * coop.c (coop_quitting_p, coop_cond_create, coop_mutex_create,
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.
2000-03-30 23:23:10 +00:00
Mikael Djurfeldt
ac1aca3515 * coop.c (coop_create): Set specific' field, not data' to NULL. 2000-03-29 10:43:18 +00:00
Mikael Djurfeldt
f85a9bcf5f * coop.c (coop_finish): New function. Called at exit.
(coop_aborthelp): Free thread structures when threads die.
Finished LinuxThreads compatibility support => COOP threads now
mesh with LinuxThreads.
2000-03-29 01:57:40 +00:00
Michael Livshin
89e00824a0 * *.[hc]: add Emacs magic at the end of file, to ensure GNU
indentation style.
2000-03-19 19:01:16 +00:00
Mikael Djurfeldt
bc5329cc8b * coop.c (coop_condition_variable_timed_wait_mutex): Use ETIMEDOUT
instead of ETIME.
2000-03-12 01:48:04 +00:00
Mikael Djurfeldt
df26ebfdc9 * coop.c: #include <errno.h>
(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,
2000-03-12 00:33:56 +00:00
Greg J. Badros
bccab49811 * threads.c, mit-pthreads.c, list.c, coop.c: Remove K&R
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.
1999-12-19 18:24:12 +00:00
Mikael Djurfeldt
b322f09ab8 * coop.c (coop_condition_variable_wait): Removed
(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.)
1998-11-19 08:15:22 +00:00
Jim Blandy
6aa9316dea Don't redefine sleep and usleep.
* 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.
1998-10-13 23:17:09 +00:00
Jim Blandy
ad1a6f1a3c The argument type of usleep varies from system to system,
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.
1998-10-12 21:08:38 +00:00
Jim Blandy
9086fa7771 * coop.c (coop_condition_variable_wait): Make this function
static.  It's only useful internally --- you should never just
wait on a condition variable.
* coop-defs.h (coop_condition_variable_wait): Delete prototype.
1998-10-04 12:10:11 +00:00
Jim Blandy
6d71500e94 Get rid of warnings from the cooperative threading system.
* 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.
1998-10-03 13:33:53 +00:00
Mikael Djurfeldt
0935d604b5 * scmsigs.c: Declare usleep as returning void on some systems.
(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.
1998-04-24 23:36:04 +00:00
Mikael Djurfeldt
2c4e1a3484 * coop.c: Changed return type of usleep to int. 1998-04-20 00:39:15 +00:00
Mikael Djurfeldt
a74145b809 * eval.c, eval.h, coop.c (scm_eval_stack, SCM_EVAL_STACK): Measure
stack size in machine words.
1998-04-12 23:34:43 +00:00
Mikael Djurfeldt
51d394a1c5 * coop.c (COOP_STKSIZE): Use SCM_EVAL_STACK. 1998-03-30 21:02:31 +00:00
Mikael Djurfeldt
d90ca38d06 * iselect.h, iselect.c, coop.c, coop-threads.c, coop-threads.h,
coop-defs.h, throw.c, backtrace.c: Added new copyright year 1998.
1998-02-06 18:55:29 +00:00
Mikael Djurfeldt
d186aac642 * coop.c, iselect.c: Since thread switches are now performed with
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.
1998-01-30 21:07:00 +00:00
Mikael Djurfeldt
c8bf4ecd10 * 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-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.
1998-01-26 01:43:16 +00:00
Mikael Djurfeldt
44e8413c73 * Makefile.am: Added iselect.c and iselect.h.
* 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.
1997-11-27 18:04:56 +00:00
Jim Blandy
82892beda5 * Lots of files: New address for FSF. 1997-05-26 22:34:48 +00:00
Jim Blandy
7bfd3b9e94 Merge threads directory into libguile.
* coop-defs.h, coop-threads.c, coop-threads.h, coop.c, threads.c,
threads.h: New source files.
* Makefile.am (EXTRA_libguile_la_SOURCES): Add threads.c.
(noinst_HEADERS): Add coop-threads.c, coop-threads.h, coop.c
here; see comment.
(modinclude_HEADERS): Add threads.h, coop-defs.h.
(EXTRA_DIST): Add fsu-pthreads.h, mit-pthreads.c, mit-pthreads.h,
coop-threads.c.cygnus, coop-threads.h.cygnus.
* configure.in: If we're using threads, include threads.o in
LIBOBJS.
* _scm.h, libguile.h: threads.h lives in this directory now.
* fsu-pthreads.h, mit-pthreads.c, mit-pthreads.h,
coop-threads.c.cygnus, coop-threads.h.cygnus: New files, not
currently used, but brought along for information's sake.
* ChangeLog-threads: log from old 'threads' directory.
* Makefile.in, configure: Rebuilt.
1997-04-15 01:34:36 +00:00