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

320 commits

Author SHA1 Message Date
Mark H Weaver
28d5d2537c Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/keywords.c
	libguile/vm.c
2013-07-16 01:33:27 -04:00
Mark H Weaver
10454601e0 Fix bug in remqueue in threads.c when removing last element.
Reported and debugged by Andrew Gaylard <ag@computer.org>.

* libguile/threads.c (remqueue): When removing the last element from a
  queue with more than one element, set (car q) to the previous element.

* THANKS: Thank Andrew Gaylard.
2013-06-17 14:51:51 -04:00
Mark H Weaver
2a1d8403c0 Allow #f as timeout argument to unlock-mutex and SRFI-18 mutex-unlock!
Reported by Chaos Eternal <chaoseternal@shlug.org>
Based on a patch by Nala Ginrut <nalaginrut@gmail.com>

* libguile/threads.c (scm_unlock_mutex_timed): If 'timeout' argument
  is false, interpret that as no timeout.

* doc/ref/api-scheduling.texi (Mutexes and Condition Variables):
  Update documentation.
2013-06-10 02:34:21 -04:00
Mark H Weaver
26d148066f Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	configure.ac
	libguile/deprecated.c
	libguile/deprecated.h
	libguile/filesys.h
	libguile/fluids.c
	libguile/fports.c
	libguile/gc.c
	libguile/guile.c
	libguile/numbers.c
	libguile/objcodes.c
	libguile/r6rs-ports.c
	libguile/smob.c
	libguile/socket.c
	libguile/threads.h
	module/language/scheme/decompile-tree-il.scm
	module/language/tree-il/peval.scm
	test-suite/tests/syncase.test
2013-03-28 05:09:53 -04:00
Andy Wingo
dbab8aaaca allow for spurious wakeups from pthread_cond_wait
* libguile/threads.c (scm_call_with_new_thread, scm_spawn_thread): Allow
  for spurious wakeups while waiting on cond variables.  Should fix bug
  10641.
2013-03-13 11:01:38 +01:00
Andy Wingo
6ab4de6125 don't provide scm_std_select on mingw and similar platforms
* libguile/iselect.h: If we do not have sys/select.h, don't provide
  scm_std_select, SELECT_TYPE, FD_SET, FD_ZERO, FD_ISSET, or FD_CLR.
  Guile should not be setting these macros in public API.  This is an
  incompatible change on mingw, but oh well.

* libguile/threads.c: Rely on gnulib's select, and use that to implement
  scm_std_select.

* libguile/deprecated.h:
* libguile/deprecated.c: Only provide scm_internal_select if we have
  sys/select.h.
2013-03-09 22:45:33 +01:00
Mark H Weaver
fd57bbf5ac Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/validate.h
2012-11-05 15:57:03 -05:00
Ludovic Courtès
02a362a665 Fix invalid assertion about mutex ownership in threads.c.
* libguile/threads.c (do_thread_exit): Don't assert m->owner == t->handle
  since that is not the case when MUTEX was abandoned by T.  Reported by Mark
  Weaver and others.
2012-11-05 21:43:13 +01:00
Andy Wingo
bc61280992 Merge remote-tracking branch 'local-2.0/stable-2.0'
Conflicts:
	configure.ac
	libguile/finalizers.c
	libguile/finalizers.h
	libguile/gc.c
	libguile/gc.h
	libguile/inline.c
	libguile/inline.h
	libguile/ports.c
	libguile/smob.c
	libguile/smob.h
	module/ice-9/deprecated.scm
	module/ice-9/r4rs.scm
2012-03-08 13:22:09 +01:00
Andy Wingo
f740445a9b run finalizers asynchronously in asyncs
* libguile/finalizers.c: New excitement!  We'll be running finalizers
  asynchronously, from asyncs.  This will make it safer to allocate
  while holding a mutex.
  (GC_set_finalizer_notifier): Add back-compat shim.

* libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism
  during boot.

* libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing
  on demand.
  (scm_gc): Explicitly run finalizers here.

* libguile/threads.c (guilify_self_2): Run finalizers here if
  queue_finalizer_async happened to run during guilify_self_1.

* configure.ac: Add check for GC_set_finalizer_notifier.
2012-03-08 13:12:10 +01:00
Andy Wingo
9ede013f68 the dynamic stack is really a stack now, instead of a list
* libguile/dynstack.h:
* libguile/dynstack.c: New files, implementing the dynamic stack as a
  true stack instead of a linked list.  This lowers the cost of
  dynwinds: frames, winders, prompts, with-fluids, and dynamic-wind.
  For the most part, we allocate these items directly on the stack.

* libguile/dynwinds.h:
* libguile/dynwinds.c: Adapt all manipulators of the wind stack to use
  interfaces from dynstack.c.  Remove heap-allocated winder and frame
  object types.
  (scm_dowinds, scm_i_dowinds): Remove these.  The first was exported,
  but it was not a public interface.

* libguile/continuations.c:
* libguile/continuations.h (scm_t_contregs): Continuation objects
  reference scm_t_dynstack* values now.  Adapt to the new interfaces.

* libguile/control.c:
* libguile/control.h: There is no longer a scm_tc7_prompt kind of object
  that can be allocated on the heap.  Instead, the prompt flags, key,
  and registers are pushed on the dynwind stack.  (The registers are
  still on the heap.)  Also, since the vm_cont will reference the
  dynwinds, make the partial continuation stub take just one extra arg,
  instead of storing the intwinds separately in the object table.

* libguile/fluids.c:
* libguile/fluids.h: No more with-fluids objects; instead, the fluids go
  on the dynstack.  The values still have to be on the heap, though.
  (scm_prepare_fluids, scm_swap_fluids): New internal functions,
  replacing scm_i_make_with_fluids and scm_i_swap_with_fluids.

* libguile/print.c: Remove prompt and with-fluids printers.

* libguile/tags.h: Revert prompt and with-fluids tc7 values to what they
  were before they were allocated.

* libguile/vm-i-system.c (partial_cont_call): Just pop the vmcont, the
  intwinds will not be passed as a second arg.  Rewind the dynamic stack
  from within the VM, so that any rewinder sees valid prompt entries.
  (call_cc, tail_call_cc): Adapt to pass the dynstack to
  scm_i_vm_capture_stack.
  (prompt, wind, unwind, wind_fluids, unwind_fluids): Adapt to the new
  interfaces.

* libguile/vm.h (scm_i_capture_current_stack): Rename from
  scm_i_vm_capture_continuation.
  (scm_i_vm_capture_stack): Take a dynstack as an argument.
* libguile/vm.c (vm_reinstate_partial_continuation): Don't wind here, as
  that could result in winders seeing invalid prompts.

* libguile/eval.c:
* libguile/root.c:
* libguile/stacks.c:
* libguile/threads.c:
* libguile/threads.h:
* libguile/throw.c: Adapt other users of dynwinds to use the dynstack.
2012-03-03 17:06:02 +01:00
Andy Wingo
fea65eb231 statically initialize the pthread mutex in fat mutexen
* libguile/threads.c (make_fat_mutex): Remove smob free function.
  Because we use normal mutexen, we can just blit the mutex to
  initialize it.
2012-02-24 18:57:37 +01:00
Andy Wingo
44b76a785c Revert "install pthread_atfork handlers for guile's static mutexen"
This reverts commit 6a97b1f93a.
2012-02-23 14:18:56 +01:00
Andy Wingo
6a97b1f93a install pthread_atfork handlers for guile's static mutexen
* libguile/async.c:
* libguile/deprecation.c:
* libguile/fluids.c:
* libguile/gc.c:
* libguile/instructions.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/strings.c:
* libguile/threads.c: Use the SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX
  mechanism to lock a number of static mutexen.
2012-02-17 12:11:14 +01:00
Andy Wingo
0858753e82 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	GUILE-VERSION
	libguile/gc-malloc.c
	libguile/ports.c
2012-02-08 11:48:08 +01:00
Bake Timmons
b7e64f8b26 Improve the usage of variable names in C docstrings.
* libguile/alist.c:
* libguile/array-map.c:
* libguile/arrays.c:
* libguile/bitvectors.c:
* libguile/filesys.c:
* libguile/foreign.c:
* libguile/generalized-arrays.c:
* libguile/hashtab.c:
* libguile/ioext.c:
* libguile/load.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/print.c:
* libguile/procprop.c:
* libguile/promises.c:
* libguile/simpos.c:
* libguile/socket.c:
* libguile/srfi-1.c:
* libguile/srfi-13.c:
* libguile/srfi-14.c:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strings.c:
* libguile/struct.c:
* libguile/symbols.c:
* libguile/threads.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Make the variable names in the C docstrings more
  consistent.  Replace a few instances of @var with @code when appropriate.
2012-02-02 12:22:10 +01:00
Andy Wingo
dfadcf85cb Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/debug.h
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
	module/language/tree-il/peval.scm
	module/language/tree-il/primitives.scm
2012-01-30 20:27:35 +01:00
Andy Wingo
252acfe8e7 Merge commit '3d51e57cfb'
Conflicts:
	libguile/foreign.c
	libguile/hashtab.c
	module/ice-9/psyntax-pp.scm
	module/language/tree-il/compile-glil.scm
2012-01-30 18:52:46 +01:00
Andy Wingo
855db1905d Merge commit '9b0975f1dc'
Conflicts:
	libguile/foreign.c
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
2012-01-30 18:25:07 +01:00
Andy Wingo
4496c9c1e8 Revert "Universally-unique gensyms"
This reverts commit ad432bc831.

Not all gensyms need to be universally-unique: most of them just need to
be unique within some portion of a Guile session.  We'll take a
different tack on this problem in the next commit.
2012-01-26 12:08:58 +01:00
Mark H Weaver
ad432bc831 Universally-unique gensyms
* libguile/symbols.c (scm_gensym): Make the gensym counter a 128-bit
  thread-local, initialized to a random number upon the first call to
  `gensym' within a given thread.  This counter is rendered as a 22 byte
  suffix of mostly base64 digits.

* libguile/threads.h (scm_i_thread): Add a thread-local gensym_counter.

* libguile/threads.c (guilify_self_1): Initialize gensym_counter to NULL.
2012-01-21 03:23:02 -05:00
Ludovic Courtès
bbd210517f Fix typo in threads.c on IA64.
* libguile/threads.c (guilify_self_1)[__ia64__]: Fix typo.  Reported by
  Bruno Haible <bruno@clisp.org>.
2012-01-16 22:16:34 +01:00
Ludovic Courtès
0f4f2d9a30 Make sure `scm_spawn_thread' returns a thread.
* libguile/threads.c (scm_spawn_thread): Add an assertion that
  DATA.thread is a thread.  This assertion is sometimes hit on
  x86_64-freebsd8.2.
2012-01-12 00:38:56 +01:00
Andy Wingo
91ee7515da Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/__scm.h
	libguile/array-map.c
	libguile/procprop.c
	libguile/tags.h
	module/ice-9/deprecated.scm
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
	test-suite/standalone/test-num2integral.c
	test-suite/tests/regexp.test
2012-01-10 00:41:42 +01:00
Andy Wingo
0bdd43515e Merge commit 'f78a1ccede' 2012-01-10 00:23:49 +01:00
Ludovic Courtès
b3da54d181 Placate a number of `syntax-check' verifications.
- "filesystem" -> "file system"
  - remove doubled words
  - use EXIT_* macros instead of literal numbers
  - update `syntax-check' exclusion files
2012-01-05 23:38:10 +01:00
Andy Wingo
ba20d2629e freebsd itanium support
* libguile/threads.c (scm_ia64_register_backing_store_base)
  (scm_ia64_ar_bsp): Provide implementation of these itanium helpers on
  freebsd.  Thanks to Jim Pryor.
2011-12-22 10:30:45 -05:00
Andy Wingo
c1d5d6d755 freebsd implementation of get_thread_stack_base
* configure.ac: Check for pthread_np.h and pthread_attr_get_np.  Patch
  by Jim Pryor.
* libguile/threads.c (get_thread_stack_base): Provide an implementation
  for FreeBSD.
2011-12-22 10:28:23 -05:00
Andy Wingo
b2208d2e98 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	configure.ac
	libguile/fluids.c
	libguile/gc.c
	libguile/gc.h
	libguile/objcodes.c
	libguile/procprop.c
	libguile/vm.c
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
2011-12-01 23:31:50 +01:00
Andy Wingo
9f7537dcab collect a little in call-with-new-thread
* libguile/threads.c (scm_call_with_new_thread): Collect a little before
  making a new thread.  Our adjust_gc_frequency hack doesn't work well
  if the main allocation load is thread creation, as in
  https://savannah.gnu.org/bugs/?34140.  This does not appreciably
  affect the speed of the test in that bug, but does effectively limit
  the image size.
2011-11-29 20:26:40 +01:00
Andy Wingo
aafb4ed724 optional default-value arg to make-fluid
* libguile/fluids.c (grow_dynamic_state, new_fluid): Arrange for the
  default value in the dynamic-state vector to be SCM_UNDEFINED instead
  of SCM_BOOL_F.  If the value in the dynamic-state is #f, default to a
  value attached to the fluid instead.  This allows useful default
  values.
  (scm_make_fluid_with_default): New function, allows the user to
  specify a default value for the fluid.  Defaults to #f.  Bound to
  `make-fluid' on the Scheme side.
  (scm_make_unbound_fluid): Use SCM_UNDEFINED as the default in all
  threads.
  (scm_fluid_unset_x): Also unset the default value.  Not sure if this
  is the right thing.
  (fluid_ref): Update to the new default-value strategy.

* libguile/threads.c (scm_i_reset_fluid): Reset to SCM_UNDEFINED.
* libguile/threads.h: Remove extra arg to scm_i_reset_fluid.
* libguile/vm-i-system.c (fluid-ref): Update to new default-value
  strategy.

* module/ice-9/vlist.scm (block-growth-factor): Default to 2 in all
  threads.  Fixes http://debbugs.gnu.org/10093.
2011-11-23 12:53:38 +01:00
Andy Wingo
0607ebbfcf locking for putc, puts
* libguile/ports.c (scm_putc, scm_puts):
* libguile/ports.h (scm_putc_unlocked, scm_puts_unlocked): Separate into
  _unlocked and locked variants.  Change all callers to use the
  _unlocked versions.
2011-11-08 00:55:05 +01:00
Andy Wingo
a141db8604 remove weak pairs, rewrite weak vectors
* libguile/weak-vector.c:
* libguile/weak-vector.h: Renamed from weaks.[ch].  Remove weak pairs.
  They were not safe to access with `car' and `cdr'.  Remove weak alist
  vectors, as we have weak tables and sets.  Reimplement weak vectors,
  moving the implementation here.

* libguile/vectors.c:
* libguile/vectors.h: Remove the extra header word.  Use
  scm_c_weak_vector_ref / scm_c_weak_vector_set_x to access weak
  vectors.

* libguile/snarf.h: Remove the extra header word in vectors.

* libguile/threads.c (do_thread_exit, fat_mutex_lock, fat_mutex_unlock):
  Instead of weak pairs, store thread-owned mutexes in a list of
  one-element weak vectors.

* libguile/guardians.c (finalize_guarded): Similarly, store object
  guardians in a list of one-element weak vectors.

* libguile/modules.c (scm_module_reverse_lookup): We no longer need to
  handle the case of weak references.

* libguile/print.c (iprin1): Use the standard vector accessor to print
  vectors.

* libguile.h:
* libguile/Makefile.am:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/goops.c:
* libguile/init.c:
* libguile/objprop.c:
* libguile/struct.c: Update includes.

* module/ice-9/weak-vector.scm: Load weak vector definitions using an
  extension instead of %init-weaks-builtins.

* test-suite/tests/weaks.test: Use the make-...-hash-table names instead
  of the old alist vector names.
2011-10-24 12:54:14 +02:00
Andy Wingo
ab4bc85398 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	GUILE-VERSION
	test-suite/tests/srfi-4.test
2011-07-25 18:26:37 +02:00
Ludovic Courtès
4f39f31ea5 Revert "Fix lock ordering in fat_mutex_lock' to match that of do_thread_exit'."
This reverts commit ccb80964cd, which
introduced a race condition, with a small window during which a mutex
could be held by a thread without being part of its `mutexes' list,
thereby violating the invariant tested at line 667.
2011-07-01 22:46:32 +02:00
Ludovic Courtès
97ec95b728 Type-check the OWNER argument of `lock-mutex'.
* libguile/threads.c (scm_lock_mutex_timed): Type-check OWNER.
2011-07-01 19:10:18 +02:00
Ludovic Courtès
b8441577f9 Fix `on_thread_exit' for canceled threads.
* libguile/threads.c (on_thread_exit): Clear `t->guile_mode' upon
  entry.  This fixes a bug whereby `t->base' would be incorrect for
  canceled threads, leading to a misdiagnosed VM stack overflow.
  See <http://lists.gnu.org/archive/html/bug-guile/2011-06/msg00068.html>
  for details.
  (scm_leave_guile_cleanup): Remove because it's unused.
2011-06-30 22:58:07 +02:00
Andy Wingo
8a562c697b Merge remote-tracking branch 'local-2.0/stable-2.0'
Conflicts:
	libguile/deprecated.c
	module/ice-9/psyntax-pp.scm
2011-06-30 13:47:46 +02:00
Ludovic Courtès
ccb80964cd Fix lock ordering in fat_mutex_lock' to match that of do_thread_exit'.
Original Helgrind report:

==14160== Thread #57: lock order "0x47F6B90 before 0x7C25A28" violated
==14160==    at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==14160==    by 0x4EFF87E: do_thread_exit (threads.c:664)
==14160==    by 0x4E87B89: c_body (continuations.c:512)
==14160==    by 0x4F16C21: vm_regular_engine (vm-i-system.c:960)
==14160==    by 0x4E90F92: scm_call_4 (eval.c:506)
==14160==    by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450)
==14160==    by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546)
==14160==    by 0x51CA3AF: GC_call_with_gc_active (pthread_support.c:1128)
==14160==    by 0x4EFF2E0: with_guile_and_parent (threads.c:206)
==14160==    by 0x51C46B4: GC_call_with_stack_base (misc.c:1505)
==14160==    by 0x4EFF447: scm_with_guile (threads.c:917)
==14160==    by 0x51C46B4: GC_call_with_stack_base (misc.c:1505)
==14160==   Required order was established by acquisition of lock at 0x47F6B90
==14160==    at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==14160==    by 0x4F00262: fat_mutex_lock (threads.c:1362)
==14160==    by 0x4F004DA: scm_lock_mutex_timed (threads.c:1462)
==14160==    by 0x4F16C09: vm_regular_engine (vm-i-system.c:898)
==14160==    by 0x4E90F4D: scm_call_3 (eval.c:499)
==14160==    by 0x4EFFA4C: really_launch (threads.c:975)
==14160==    by 0x4E87B89: c_body (continuations.c:512)
==14160==    by 0x4F16C21: vm_regular_engine (vm-i-system.c:960)
==14160==    by 0x4E90F92: scm_call_4 (eval.c:506)
==14160==    by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450)
==14160==    by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546)
==14160==    by 0x4EFF289: with_guile_and_parent (threads.c:874)
==14160==   followed by a later acquisition of lock at 0x7C25A28
==14160==    at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==14160==    by 0x4F00352: fat_mutex_lock (threads.c:1374)
==14160==    by 0x4F004DA: scm_lock_mutex_timed (threads.c:1462)
==14160==    by 0x4F16C09: vm_regular_engine (vm-i-system.c:898)
==14160==    by 0x4E90F4D: scm_call_3 (eval.c:499)
==14160==    by 0x4EFFA4C: really_launch (threads.c:975)
==14160==    by 0x4E87B89: c_body (continuations.c:512)
==14160==    by 0x4F16C21: vm_regular_engine (vm-i-system.c:960)
==14160==    by 0x4E90F92: scm_call_4 (eval.c:506)
==14160==    by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450)
==14160==    by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546)
==14160==    by 0x4EFF289: with_guile_and_parent (threads.c:874)

* libguile/threads.c (fat_mutex_lock): In the `m->level == 0' case,
  release M's lock before taking T's `admin_mutex'.
2011-06-28 15:25:22 +02:00
Andy Wingo
3b971a59b5 don't spawn the signal delivery thread in a thread-exit handler
* libguile/threads.c (do_thread_exit): Remove needless spawn of the
  signal delivery thread.
2011-06-23 11:31:10 +02:00
Andy Wingo
99cc1092a8 Merge remote-tracking branch 'local-2.0/stable-2.0' 2011-06-16 20:01:56 +02:00
Andy Wingo
32f94bf258 O_CLOEXEC usage
* libguile/objcodes.c (scm_load_objcode):
* libguile/scmsigs.c (start_signal_delivery_thread):
* libguile/threads.c (guilify_self_1): Use O_CLOEXEC.
2011-06-16 19:47:26 +02:00
Andy Wingo
0b77014f0c fix initial values of reallocated fluids
* libguile/threads.h:
* libguile/threads.c (scm_i_reset_fluid): New internal function, resets
  the binding of a fluid for all threads.  Needed for fluid GC.

* libguile/fluids.c (new_fluid): Call scm_i_reset_fluid here.
2011-06-16 19:39:58 +02:00
Mark H Weaver
9ec1573d2b Don't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong type
* libguile/threads.c (lock_mutex_return_void, unlock_mutex_return_void):
  New static functions that simply call scm_lock_mutex and
  scm_unlock_mutex, respectively, but return void instead of SCM.

  (scm_dynwind_lock_mutex): Pass unlock_mutex_return_void to
  scm_dynwind_unwind_handler_with_scm, and lock_mutex_return_void to
  scm_dynwind_rewind_handler_with_scm.  Previously, we passed
  scm_unlock_mutex and scm_lock_mutex (which return SCM), but the
  scm_dynwind_* functions expect pointers to functions which return
  void.  When SCM is of type union, this changes the calling conventions
  of the functions on some platforms (e.g. GCC 4.5.2 and 4.5.3 on x86).
2011-05-22 15:45:28 -04:00
Mark H Weaver
2a3db25e28 Don't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong type
* libguile/threads.c (lock_mutex_return_void, unlock_mutex_return_void):
  New static functions that simply call scm_lock_mutex and
  scm_unlock_mutex, respectively, but return void instead of SCM.

  (scm_dynwind_lock_mutex): Pass unlock_mutex_return_void to
  scm_dynwind_unwind_handler_with_scm, and lock_mutex_return_void to
  scm_dynwind_rewind_handler_with_scm.  Previously, we passed
  scm_unlock_mutex and scm_lock_mutex (which return SCM), but the
  scm_dynwind_* functions expect pointers to functions which return
  void.  When SCM is of type union, this changes the calling conventions
  of the functions on some platforms (e.g. GCC 4.5.2 and 4.5.3 on x86).
2011-05-22 15:23:27 -04:00
Andy Wingo
4765b28f70 use of EXIT_SUCCESS and EXIT_FAILURE
* libguile/threads.c (scm_init_guile):
* libguile/throw.c (scm_exit_status): Use EXIT_SUCCESS and EXIT_FAILURE
  instead of 0 and 1.
2011-05-15 15:34:16 +02:00
Andy Wingo
27c6ebcb16 rename scm_async_click() to scm_async_tick(); privatize SCM_ASYNC_TICK
* libguile/_scm.h (SCM_ASYNC_TICK, SCM_ASYNC_TICK_WITH_CODE): Make these
  definitions private.  Call the tick() function instead of click().

* libguile/__scm.h:
* libguile/async.h (scm_async_tick): Move declaration here.  Remove
  scm_async_click declaration.  Tick is the new (and old!) click, you
  see.
  (SCM_CRITICAL_SECTION_END): Call tick() instead of click().

* libguile/async.c (scm_async_tick): Remove old definition, and rename
  scm_async_click to scm_async_tick.
  (decrease_block): Adapt to click() -> tick() name change.

* libguile/deprecated.h (scm_async_click, SCM_ASYNC_TICK): Define some
  GONE macros.

* libguile/threads.c (fat_mutex_unlock): Tick() instead of click().
2011-05-15 15:34:16 +02:00
Andy Wingo
2002f1f847 refactor do_thread_exit cleanup handler invocation
* libguile/threads.c (do_thread_exit): Redo cleanup handler call so as
  not to shove a SCM into a pointer.
2011-05-13 15:33:51 +02:00
Ludovic Courtès
d20912e67d Move {total,current}-processor-count' outside of posix.c'.
* libguile/posix.c (scm_total_processor_count,
  scm_current_processor_count): Move to...
* libguile/threads.c: ... here.

* libguile/posix.h (scm_total_processor_count,
  scm_current_processor_count): Move declarations to...
* libguile/threads.h: ... here.

* test-suite/tests/posix.test ("nproc"): Move tests to...
* test-suite/tests/threads.test: ... here.
2011-04-25 22:41:58 +02:00
Ludovic Courtès
912308835d Make `scm_i_ensure_signal_delivery_thread' call in Guile mode.
* libguile/threads.c (on_thread_exit): Move
  `scm_i_ensure_signal_delivery_thread' call...
  (do_thread_exit): ... here.
2011-04-25 16:45:22 +02:00