summaryrefslogtreecommitdiff
path: root/libguile/coop.c
AgeCommit message (Collapse)AuthorFilesLines
2009-01-18Remove useless cooperative multi-threading source files.Ludovic Courtès1-761/+0
2008-09-13Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.Ludovic Courtès1-1/+1
2006-04-17merge from 1.8 branchKevin Ryde1-2/+2
2005-05-23The FSF has a new address.Marius Vollmer1-2/+2
2003-04-05Changed license terms to the plain LGPL thru-out.Marius Vollmer1-37/+13
2003-03-27* coop.c: fix various preprocessor usages of new publicRob Browning1-4/+4
symbols to expect 0 or 1 values rather than 1 or undefined. i.e. change #ifdef to #if, etc.
2003-03-25* coop.c: replace usage of struct timespect with scm_t_timespec.Rob Browning1-2/+6
#include <config.h> if HAVE_CONFIG_H.
2002-11-04(coop_next_runnable_thread): Removed, wich should have happened whenMarius Vollmer1-35/+1
GUILE_ISELECT was hard-wired.
2002-11-03* __scm.h (USE_THREADS, GUILE_ISELECT): Define whenMarius Vollmer1-73/+3
SCM_DEBUG_DEPRECATED. Removed their use thru-out Guile.
2002-10-27* coop-defs.h (coop_m): Added 'level' field.Marius Vollmer1-17/+42
(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-08-17 * coop.c (coop_create): removed bogus 2nd argument in scm_mallocGary Houston1-3/+2
call.
2002-08-16* mallocs.c (scm_malloc_obj): use scm_gc_malloc in stead ofHan-Wen Nienhuys1-4/+4
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.
2001-11-042001-11-04 Stefan Jahn <stefan@lkcc.org>Stefan Jahn1-2/+7
* 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-10-06* coop.c (mother_awake_p): New variable.Mikael Djurfeldt1-2/+5
(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-03-10* coop.c: Inserted #include <stdio.h>.Mikael Djurfeldt1-2/+4
* iselect.c: Reinserted #include <stdio.h>.
2000-11-30* coop-threads.c: Don't join finished threads. Thanks to Julian Satchell.Dirk Herrmann1-10/+1
* coop.c: Removed old non-working code.
2000-04-21* Makefile.am (DEFS): Added. automake adds -I options to DEFS,Mikael Djurfeldt1-3/+3
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-10*** empty log message ***Mikael Djurfeldt1-2/+5
2000-04-10* coop.c (mother): Handled EINTR (the wait has been interrupted byMikael Djurfeldt1-2/+5
a signal).
2000-03-30* coop.c (coop_quitting_p, coop_cond_create, coop_mutex_create,Mikael Djurfeldt1-9/+49
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-29* coop.c (coop_create): Set `specific' field, not `data' to NULL.Mikael Djurfeldt1-8/+11
2000-03-29* coop.c (coop_finish): New function. Called at exit.Mikael Djurfeldt1-31/+95
(coop_aborthelp): Free thread structures when threads die. Finished LinuxThreads compatibility support => COOP threads now mesh with LinuxThreads.
2000-03-19 * *.[hc]: add Emacs magic at the end of file, to ensure GNUMichael Livshin1-1/+7
indentation style.
2000-03-12* coop.c (coop_condition_variable_timed_wait_mutex): Use ETIMEDOUTMikael Djurfeldt1-3/+3
instead of ETIME.
2000-03-12* coop.c: #include <errno.h>Mikael Djurfeldt1-2/+187
(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,
1999-12-19* threads.c, mit-pthreads.c, list.c, coop.c: Remove K&RGreg J. Badros1-153/+1
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.
1998-11-19* coop.c (coop_condition_variable_wait): RemovedMikael Djurfeldt1-24/+23
(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-10-13Don't redefine sleep and usleep.Jim Blandy1-42/+18
* 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-12The argument type of usleep varies from system to system,Jim Blandy1-4/+4
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-04* coop.c (coop_condition_variable_wait): Make this functionJim Blandy1-3/+3
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-03Get rid of warnings from the cooperative threading system.Jim Blandy1-5/+21
* 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-04-24* scmsigs.c: Declare usleep as returning void on some systems.Mikael Djurfeldt1-1/+7
(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-20* coop.c: Changed return type of usleep to int.Mikael Djurfeldt1-2/+4
1998-04-12* eval.c, eval.h, coop.c (scm_eval_stack, SCM_EVAL_STACK): MeasureMikael Djurfeldt1-2/+2
stack size in machine words.
1998-03-30* coop.c (COOP_STKSIZE): Use SCM_EVAL_STACK.Mikael Djurfeldt1-2/+4
1998-02-06* iselect.h, iselect.c, coop.c, coop-threads.c, coop-threads.h,Mikael Djurfeldt1-2/+2
coop-defs.h, throw.c, backtrace.c: Added new copyright year 1998.
1998-01-30* coop.c, iselect.c: Since thread switches are now performed withMikael Djurfeldt1-2/+17
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-26* coop.c (coop_mutex_init, coop_mutex_lock, coop_mutex_unlock,Mikael Djurfeldt1-13/+63
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.
1997-11-27* Makefile.am: Added iselect.c and iselect.h.Mikael Djurfeldt1-18/+72
* 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-05-26* Lots of files: New address for FSF.Jim Blandy1-4/+4
1997-04-15Merge threads directory into libguile.Jim Blandy1-0/+588
* 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.