summaryrefslogtreecommitdiff
path: root/libguile/coop-threads.c
AgeCommit message (Collapse)AuthorFilesLines
2005-03-02See ChangeLog from 2005-03-02.Marius Vollmer1-0/+0
2004-09-22*** empty log message ***Marius Vollmer1-549/+0
2004-07-06* deprecated.h, boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOL,Marius Vollmer1-4/+4
SCM_NEGATE_BOOL, SCM_BOOLP): Deprecated by moving into "deprecated.h". Replaced all uses with scm_is_false, scm_is_true, scm_from_bool, and scm_is_bool, respectively.
2003-04-05Changed license terms to the plain LGPL thru-out.Marius Vollmer1-36/+12
2003-03-27* coop-threads.c: fix various preprocessor usages of new publicRob Browning1-2/+2
symbols to expect 0 or 1 values rather than 1 or undefined. i.e. change #ifdef to #if, etc.
2003-03-25* coop-threads.c: #include "libguile/_scm.h" early. ReplaceRob Browning1-3/+4
usage of struct timespect with scm_t_timespec. Replace usage of STACK_GROWS_UP with SCM_STACK_GROWS_UP.
2002-10-27* coop-defs.h (coop_m): Added 'level' field.Marius Vollmer1-5/+66
(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-16(scm_i_thread_root): Do not validate argument.Marius Vollmer1-3/+0
2002-10-03* coop-defs.h (coop_t): Added new "handle" slot.Marius Vollmer1-1/+34
* coop-threads.c (all_threads, scm_current_thread, scm_all_threads, scm_i_thread_root): New. (scm_threads_init): Add main thread to all_threads. (scheme_launch_thread): Remove thread from all_threads when it terminates. (scm_call_with_new_thread): Initialize handle slot of coop_t structure and add new thread to all_threads. (scm_spawn_thread): Likewise.
2002-03-01Changes in doc/ref:Dirk Herrmann1-2/+2
* api.txt, data-rep.texi: Renamed the struct scm_cell to scm_t_cell. * data-rep.texi: Renamed scm_alloc_cell to scm_cell and scm_alloc_double_cell to scm_double_cell. Changes in libguile: * gc.c (SCM_HEAP_SEG_SIZE, CELL_UP, CELL_DN, NEXT_DATA_CELL, init_heap_seg, alloc_some_heap), gc.h (struct scm_cell, struct scm_t_cell, SCM_CELLPTR, SCM_GC_CARD_SIZE, SCM_GC_IN_CARD_HEADERP), tags.h (SCM_CELLP): Renamed the struct scm_cell and all its uses to scm_t_cell in accordance to Guile's naming scheme for types. * alist.c (scm_acons), convert.i.c (CTYPES2UVECT, CTYPES2UVECT_OPTIONAL), coop-threads.c (scm_call_with_new_thread, scm_spawn_thread), debug.c (scm_make_debugobj), environments.c (scm_make_environment), eval.c (scm_closure), fports.c (scm_fdes_to_port), gc.c (scm_deprecated_newcell, scm_deprecated_newcell2), inline.h (scm_alloc_cell, scm_cell), list.c (SCM_I_CONS), numbers.c (scm_i_mkbig), pairs.c (scm_cons), ports.c (scm_void_port), procs.c (scm_c_make_subr, scm_makcclo), smob.c (scm_make_smob), smob.h (SCM_NEWSMOB), strings.c (scm_take_str, scm_allocate_string), strports.c (scm_mkstrport), unif.c (scm_make_uve), variable.c (make_variable), vectors.c (scm_c_make_vector), vports.c (scm_make_soft_port): Renamed scm_alloc_cell to scm_cell. * environments.c (core_environments_observe), gc.c (scm_deprecated_newcell2), goops.c (wrap_init, scm_wrap_object), inline.h (scm_alloc_double_cell, scm_double_cell), num2float.i.c (FLOAT2NUM), numbers.c (scm_make_real), procs.c (scm_make_procedure_with_setter), smob.h (SCM_NEWSMOB2, SCM_NEWSMOB3), struct.c (scm_make_struct, scm_make_vtable_vtable), symbols.c (scm_mem2symbol, scm_mem2uninterned_symbol), weaks.c (allocate_weak_vector): Renamed scm_alloc_double_cell to scm_double_cell.
2002-02-11* gc.h, gc.c (scm_gc_sweep): Issue deprecation warning whenMarius Vollmer1-11/+5
non-zero is returned from a port or smob free function. (scm_malloc, scm_realloc, scm_strndup, scm_strdup, scm_gc_register_collectable_memory, scm_gc_unregister_collectable_memory, scm_gc_malloc, scm_gc_realloc, scm_gc_free, scm_gc_strndup, scm_gc_strdup): New. * backtrace.c, continuations.c, convert.i.c, coop-threads.c, debug-malloc.c, dynl.c, environments.c, environments.h, extensions.c, filesys.c, fports.c, gc.c, gc.h, gh_data.c, goops.c, guardians.c, hooks.c, init.c, keywords.c, load.c, numbers.c, ports.c, posix.c, procs.c, rdelim.c, regex-posix.c, root.c, smob.c, stime.c, strings.c, struct.c, struct.h, symbols.c, unif.c, vectors.c, weaks.c: Use scm_gc_malloc/scm_malloc and scm_gc_free/free instead of scm_must_malloc and scm_must_free, as appropriate. Return zero from smob and port free functions. * debug-malloc.c (scm_malloc_reregister): Handle "old == NULL". * fports.c (scm_setvbuf): Reset read buffer to saved values when it is pointing to the putback buffer.
2001-11-25Replaced SCM_NEWCELL and SCM_NEWCELL2 with scm_alloc_cell andMarius Vollmer1-4/+2
scm_alloc_double_cell, respectively.
2001-07-09Remove "face-lift" comment.Thien-Thi Nguyen1-2/+0
2001-06-26 * eval.c (scm_call_0, scm_call_1, scm_call_2, scm_call_3,Keisuke Nishida1-4/+2
scm_apply_0, scm_apply_1, scm_apply_2, scm_apply_3): New functions.
2001-06-14replace "scm_*_t" with "scm_t_*".Marius Vollmer1-12/+12
2001-05-24* validate.hMichael Livshin1-2/+2
(SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,BITS,UBITS,INT,UINT}[_DEF]): new macros. * unif.h: type renaming: scm_array -> scm_array_t scm_array_dim -> scm_array_dim_t the old names are deprecated, all in-Guile uses changed. * tags.h (scm_ubits_t): new typedef, representing unsigned scm_bits_t. * stacks.h: type renaming: scm_info_frame -> scm_info_frame_t scm_stack -> scm_stack_t the old names are deprecated, all in-Guile uses changed. * srcprop.h: type renaming: scm_srcprops -> scm_srcprops_t scm_srcprops_chunk -> scm_srcprops_chunk_t the old names are deprecated, all in-Guile uses changed. * gsubr.c, procs.c, print.c, ports.c, read.c, rdelim.c, ramap.c, rw.c, smob.c, sort.c, srcprop.c, stacks.c, strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c, unif.c, values.c, vectors.c, vports.c, weaks.c: various int/size_t -> size_t/scm_bits_t changes. * random.h: type renaming: scm_rstate -> scm_rstate_t scm_rng -> scm_rng_t scm_i_rstate -> scm_i_rstate_t the old names are deprecated, all in-Guile uses changed. * procs.h: type renaming: scm_subr_entry -> scm_subr_entry_t the old name is deprecated, all in-Guile uses changed. * options.h (scm_option_t.val): unsigned long -> scm_bits_t. type renaming: scm_option -> scm_option_t the old name is deprecated, all in-Guile uses changed. * objects.c: various long -> scm_bits_t changes. (scm_i_make_class_object): flags: unsigned long -> scm_ubits_t * numbers.h (SCM_FIXNUM_BIT): deprecated, renamed to SCM_I_FIXNUM_BIT. * num2integral.i.c: new file, multiply included by numbers.c, used to "templatize" the various integral <-> num conversion routines. * numbers.c (scm_mkbig, scm_big2num, scm_adjbig, scm_normbig, scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl): deprecated. (scm_i_mkbig, scm_i_big2inum, scm_i_adjbig, scm_i_normbig, scm_i_copybig, scm_i_short2big, scm_i_ushort2big, scm_i_int2big, scm_i_uint2big, scm_i_long2big, scm_i_ulong2big, scm_i_bits2big, scm_i_ubits2big, scm_i_size2big, scm_i_ptrdiff2big, scm_i_long_long2big, scm_i_ulong_long2big, scm_i_dbl2big, scm_i_big2dbl, scm_short2num, scm_ushort2num, scm_int2num, scm_uint2num, scm_bits2num, scm_ubits2num, scm_size2num, scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int, scm_num2uint, scm_num2bits, scm_num2ubits, scm_num2ptrdiff, scm_num2size): new functions. * modules.c (scm_module_reverse_lookup): i, n: int -> scm_bits_t.x * load.c: change int -> size_t in various places (where the variable is used to store a string length). (search-path): call scm_done_free, not scm_done_malloc. * list.c (scm_ilength): return a scm_bits_t, not long. some other {int,long} -> scm_bits_t changes. * hashtab.c: various [u]int -> scm_bits_t changes. scm_ihashx_closure -> scm_ihashx_closure_t (and made a typedef). (scm_ihashx): n: uint -> scm_bits_t use scm_bits2num instead of scm_ulong2num. * gsubr.c: various int -> scm_bits_t changes. * gh_data.c (gh_scm2double): no loss of precision any more. * gh.h (gh_str2scm): len: int -> size_t (gh_{get,set}_substr): start: int -> scm_bits_t, len: int -> size_t (gh_<num>2scm): n: int -> scm_bits_t (gh_*vector_length): return scm_[u]size_t, not unsigned long. (gh_length): return scm_bits_t, not unsigned long. * fports.h: type renaming: scm_fport -> scm_fport_t the old name is deprecated, all in-Guile uses changed. * fports.c (fport_fill_input): count: int -> scm_bits_t (fport_flush): init_size, remaining, count: int -> scm_bits_t * debug.h (scm_lookup_cstr, scm_lookup_soft, scm_evstr): removed those prototypes, as the functions they prototype don't exist. * fports.c (default_buffer_size): int -> size_t (scm_fport_buffer_add): read_size, write_size: int -> scm_bits_t default_size: int -> size_t (scm_setvbuf): csize: int -> scm_bits_t * fluids.c (n_fluids): int -> scm_bits_t (grow_fluids): old_length, i: int -> scm_bits_t (next_fluid_num, scm_fluid_ref, scm_fluid_set_x): n: int -> scm_bits_t (scm_c_with_fluids): flen, vlen: int -> scm_bits_t * filesys.c (s_scm_open_fdes): changed calls to SCM_NUM2LONG to the new and shiny SCM_NUM2INT. * extensions.c: extension -> extension_t (and made a typedef). * eval.h (SCM_IFRAME): cast to scm_bits_t, not int. just so there are no nasty surprises if/when the various deeply magic tag bits move somewhere else. * eval.c: changed the locals used to store results of SCM_IFRAME, scm_ilength and such to be of type scm_bits_t (and not int/long). (iqq): depth, edepth: int -> scm_bits_t (scm_eval_stack): int -> scm_bits_t (SCM_CEVAL): various vars are not scm_bits_t instead of int. (check_map_args, scm_map, scm_for_each): len: long -> scm_bits_t i: int -> scm_bits_t * environments.c: changed the many calls to scm_ulong2num to scm_ubits2num. (import_environment_fold): proc_as_ul: ulong -> scm_ubits_t * dynwind.c (scm_dowinds): delta: long -> scm_bits_t * debug.h: type renaming: scm_debug_info -> scm_debug_info_t scm_debug_frame -> scm_debug_frame_t the old names are deprecated, all in-Guile uses changed. (scm_debug_eframe_size): int -> scm_bits_t * debug.c (scm_init_debug): use scm_c_define instead of the deprecated scm_define. * continuations.h: type renaming: scm_contregs -> scm_contregs_t the old name is deprecated, all in-Guile uses changed. (scm_contregs_t.num_stack_items): size_t -> scm_bits_t (scm_contregs_t.num_stack_items): ulong -> scm_ubits_t * continuations.c (scm_make_continuation): change the type of stack_size form long to scm_bits_t. * ports.h: type renaming: scm_port_rw_active -> scm_port_rw_active_t (and made a typedef) scm_port -> scm_port_t scm_ptob_descriptor -> scm_ptob_descriptor_t the old names are deprecated, all in-Guile uses changed. (scm_port_t.entry): int -> scm_bits_t. (scm_port_t.line_number): int -> long. (scm_port_t.putback_buf_size): int -> size_t. * __scm.h (long_long, ulong_long): deprecated (they pollute the global namespace and have little value besides that). (SCM_BITS_LENGTH): new, is the bit size of scm_bits_t (i.e. of an SCM handle). (ifdef spaghetti): include sys/types.h and sys/stdtypes.h, if they exist (for size_t & ptrdiff_t) (scm_sizet): deprecated. * Makefile.am (noinst_HEADERS): add num2integral.i.c
2001-03-17* validate.h (SCM_WRONG_NUM_ARGS): Call scm_error_num_args_subrDirk Herrmann1-1/+0
instead of scm_wrong_num_args. * coop-threads.c: Don't include libguile/strings.h. (Was only needed for former implementation of SCM_WRONG_NUM_ARGS.) * debug.c (scm_m_start_stack): Don't use SCM_ASSERT to check for wrong-num-args errors.
2001-03-08* coop-threads.c: Fixed change of 2001-03-06.Mikael Djurfeldt1-1/+1
2001-03-06* Remove uses of SCM_ASSERT that may result in error messages differentDirk Herrmann1-10/+11
from wrong-type-arg errors.
2000-11-30* coop-threads.c: Don't join finished threads. Thanks to Julian Satchell.Dirk Herrmann1-3/+16
* coop.c: Removed old non-working code.
2000-09-26* Replaced a lot of references to SCM_CHARS.Dirk Herrmann1-4/+4
2000-04-21* Makefile.am (DEFS): Added. automake adds -I options to DEFS,Mikael Djurfeldt1-5/+5
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-03-30* coop-defs.h, coop-threads.c (struct coop_t): EliminateMikael Djurfeldt1-0/+2
`sto'-field when GUILE_PTHREAD_COMPAT is enabled.
2000-03-29* coop-threads.c (scm_call_with_new_thread, scm_spawn_thread,Mikael Djurfeldt1-4/+4
scm_make_mutex, scm_make_condition_variable): Cast data to scm_bits_t in SCM_SET_CELL_WORD and SCM_NEWSMOB macros.
2000-03-29* coop-threads.c (scm_call_with_new_thread, scm_spawn_thread):Mikael Djurfeldt1-2/+3
Changed SETCDR --> SET_CELL_WORD_1. * coop-threads.c (scheme_launch_thread): Set word 1 of handle to 0 when thread dies.
2000-03-19* coop-threads.c: Addd #include "root.h", #include "strings.h".Mikael Djurfeldt1-0/+2
2000-03-19 * *.[hc]: add Emacs magic at the end of file, to ensure GNUMichael Livshin1-0/+6
indentation style.
2000-03-12* struct.c, coop-threads.c: SCM_ASSCM/ASWORD fixes.Mikael Djurfeldt1-3/+3
2000-03-03* error.h, error.c: Added `scm_wrong_type_arg_msg' to supportGreg J. Badros1-1/+1
displaying the expected type. Use SCM_LISTn in a couple places instead of scm_cons-ing by hand. * __scm.h: Added SCM_ASSERT_TYPE macro. * validate.h, scm_validate.h: Added the former, as a renamed version of the latter with SCM_ASSERT_TYPE used in SCM_MAKE_VALIDATE (instead of just SCM_ASSERT) * Makefile.am: Rename scm_validate.h to validate.h. * *.c, *.h: Include validate.h, not scm_validate.h (old name's prefix was superfluous).
2000-01-05* *.[ch]: Whitespace changes -- added space after SCM_VALIDATE_*Greg J. Badros1-1/+1
macros and SCM_DEFINE macros to match GNU coding standards.
2000-01-03* dynl-vms.c, debug.c, coop-threads.c, backtrace.c, eval.c: MoreGreg J. Badros1-1/+1
SCM_NIMP tests that were redundant are now eliminated. Patches from Dirk Hermann applied by hand.
1999-12-16* coop-threads.c: Remove K&R function headers.Greg J. Badros1-72/+17
* scm_validate.h: Added SCM_VALIDATE_THREAD. * *.c: Remove SCM_NIMP(X) when it is an extraneous pre-test given that SCM_FOOP macros all now include SCM_NIMP in their expansion. This simplifies lots of code, making it far more readable.
1999-12-13* Makefile.am: Fix ETAGS_ARGS to recognize GUILE_PROC,Greg J. Badros1-6/+0
GUILE_PROC1. Build guile-procedures.txt, and add that file to pkgdata_DATA. * load.c: Added `pkgdata-dir', `site-dir', `library-dir' primitives. * guile-doc-snarf.awk: Drop trailing space when no arguments: e.g., "(foo )" is now "(foo)". * *.c: moved all the documentation for primitives from guile-doc/ref/{appendices,posix,scheme}.texi into the source code. This leaves about half of the primitives undocumented. Also, all the markup is currently still texinfo. I don't have a problem with texinfo per se, but the markup is not very descriptive or accurate.
1999-07-07Greg's smob patchMikael Djurfeldt1-49/+3
1998-10-03Get rid of warnings from the cooperative threading system.Jim Blandy1-6/+6
* 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-02-06* iselect.h, iselect.c, coop.c, coop-threads.c, coop-threads.h,Mikael Djurfeldt1-1/+1
coop-defs.h, throw.c, backtrace.c: Added new copyright year 1998.
1998-02-02* backtrace.c (display_error_body, display_backtrace_body),Mikael Djurfeldt1-3/+3
coop-threads.c (scheme_body_bootstrip, c_body_bootstrip), gh_eval.c (eval_str_wrapper, eval_file_wrapper), init.c (invoke_main_func), root.c (cwdr_body), throw.c (cwss_body, scm_body_thunk, hbpca_body): Removed the second jmpbuf arg on body functions.
1998-01-30* coop-threads.c (scheme_launch_data, scheme_body_bootstrip,Mikael Djurfeldt1-21/+73
scheme_handler_bootstrip, scheme_launch_thread, c_launch_data, c_body_bootstrip, c_handler_bootstrip, c_launch_thread): Add an extra layer of functions around the body and handler of a thread. This extra layer makes sure that the handler is called in the dynamic context of the surround (= empty dynwind list), but under the *dynamic root* of the body. We can not use the dynamic root of the surround since that root belongs to another thread => stack is not handled correctly. It may seem ugly to use this extra layer, but the extra cost in terms of execution time is really negligible compared to the total amount of time required to create a thread, and it would reduce maintainability to duplicate the crucial and complicated steps performed by cwdr. * coop-threads.c (scm_wait_condition_variable): Use coop_condition_variable_wait_mutex.
1998-01-26* coop.c (coop_mutex_init, coop_mutex_lock, coop_mutex_unlock,Mikael Djurfeldt1-3/+2
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-23* coop-threads.c, threads.h (scm_spawn_thread): New function.Mikael Djurfeldt1-9/+88
Can spawn a thread from application C code.
1997-08-14* stacks.c (scm_make_stack), coop-threads.c, mit-pthreads.cMikael Djurfeldt1-3/+9
(scm_call_with_new_thread): Bugfix: SCM_WNA should go as third argument to SCM_ASSERT. Furthermore, the name of the function should be passed as first argument when signalling SCM_WNA. (Thanks to Thomas Morgan)
1997-07-04* coop-threads.c (scm_wait_condition_variable): Lock mutex againMarius Vollmer1-0/+1
after waiting.
1997-05-26* Lots of files: New address for FSF.Jim Blandy1-3/+3
1997-04-15Merge threads directory into libguile.Jim Blandy1-0/+439
* 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.