1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00
Commit graph

28 commits

Author SHA1 Message Date
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