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

312 commits

Author SHA1 Message Date
Andy Wingo
e0f17417e6 Optimize lock-mutex
* libguile/threads.c (lock_mutex, scm_timed_lock_mutex): As with
  unlock_mutex before, optimize by specializing to the mutex kind.
  Also, avoid lock thrashing after a return from block_self.
2016-11-13 15:56:21 +01:00
Andy Wingo
950e728e7a Improve mutexes / condition variable implementation
* libguile/threads.c (scm_timed_lock_mutex): Use "level" field only for
  recursive mutexes.
  (unlock_mutex, scm_unlock_mutex): Factor implementation back out of
  scm_unlock_mutex (doh?), but in such a way that can specialize against
  mutex type.
  (scm_mutex_level): Only look at level for recursive mutexes.
  (scm_mutex_locked_p): Look at owner field, not level field.
  (timed_wait, scm_timed_wait_condition_variable): Factor implementation
  out, as above with unlock-mutex.  Specialize relocking of the Guile
  mutex.
2016-11-13 15:56:21 +01:00
Andy Wingo
6bb51193df Refactor GC implications of thread sleep
* libguile/async.c (struct scm_thread_wake_data): Move definition here.
  (scm_i_setup_sleep): Remove "sleep_object".  Caller now responsible
  for scm_remember_upto_here_1 as appropriate.
  (scm_system_async_mark_for_thread): Remove scm_remember_upto_here_1
  call.
* libguile/async.h (scm_i_setup_sleep): Adapt prototype.
* libguile/threads.h (struct scm_thread_wake_data): Remove definition.
* libguile/threads.c (block_self): Remove sleep_object argument.
  (scm_join_thread_timed, scm_timed_lock_mutex)
  (scm_timed_wait_condition_variable, scm_std_select): Adapt.
2016-11-13 15:56:21 +01:00
Andy Wingo
1ed9dea34a Unlocked mutexes don't have owners
* libguile/threads.c (scm_unlock_mutex)
  (scm_timed_wait_condition_variable): Unlocked mutexes should never
  have owners.
2016-11-13 15:56:21 +01:00
Andy Wingo
4110e7bbb1 Put mutex kind in SMOB flags
* libguile/threads.c (struct scm_mutex, SCM_MUTEX_KIND, scm_make_mutex)
  (scm_timed_lock_mutex, scm_unlock_mutex)
  (scm_timed_wait_condition_variable): Mutex kind in SMOB flags.
2016-11-13 15:56:21 +01:00
Andy Wingo
7fd10d21c0 Rename Guile's internal mutexes and condvars
* libguile/threads.c: Rename fat_mutex to struct scm_mutex, and likewise
  for scm_cond.
2016-11-13 15:56:21 +01:00
Andy Wingo
e7c658a611 Internal threads refactor
* libguile/threads.c: Inline "fat mutexes" and "fat conds" into their
  users.  These are just Guile mutexes and Guile condition variables.
2016-11-13 15:56:21 +01:00
Andy Wingo
03ffd726df scm_timed_lock_mutex replaces scm_lock_mutex_timed
* libguile/deprecated.h:
* libguile/deprecated.c (scm_lock_mutex_timed): Deprecate.
* libguile/threads.h:
* libguile/threads.c (scm_timed_lock_mutex): New function.
  (scm_join_thread): Fix formatting.
  (scm_lock_mutex): Fix formatting and update to scm_timed_lock_mutex
  change.
  (scm_try_mutex): Update to scm_timed_lock_mutex.
2016-11-05 19:39:12 +01:00
Andy Wingo
fc4df456a1 Separate fat mutex unlock and wait operations
* libguile/threads.c (fat_mutex_unlock, fat_mutex_wait): Separate wait
  from unlock.
  (scm_unlock_mutex, scm_timed_wait_condition_variable): Adapt.
2016-11-05 11:51:02 +01:00
Andy Wingo
56dd476af7 Back to simple unlock-mutex
* libguile/threads.c (scm_unlock_mutex): Bind to unlock-mutex.
* libguile/threads.h: Remove scm_unlock_mutex_timed.
* libguile/deprecated.h: Add scm_unlock_mutex_timed.
* libguile/deprecated.c (scm_unlock_mutex_timed): Deprecate.
* test-suite/tests/threads.test: Update unlock-mutex tests to use
  wait-condition-variable if they would wait on a cond.
2016-11-05 11:50:31 +01:00
Andy Wingo
7682461241 Replace scm_make_mutex_with_flags
* libguile/threads.c (enum fat_mutex_kind): New data type, replacing
  separate flags.
  (struct fat_mutex): Adapt.
  (make_fat_mutex): Fat mutexes can only be one of three kinds, not one
  of 4 kinds.  (Recursive unowned mutexes are not a thing.)
  (scm_make_mutex): Adapt.
  (scm_make_mutex_with_kind): New function, replacing
  scm_make_mutex_with_flags.  Still bound to make-mutex.
  (scm_make_recursive_mutex): Adapt.
  (fat_mutex_lock, fat_mutex_unlock): Adapt.
* libguile/threads.h (scm_make_mutex_with_kind): New decl.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_make_mutex_with_flags): Deprecate.
2016-11-05 11:16:46 +01:00
Andy Wingo
c0916134ac Remove unchecked-unlock facility from Guile mutexes
* libguile/threads.c (fat_mutex): Remove unchecked_unlock member.
  (make_fat_mutex): Adapt.
  (scm_make_mutex_with_flags): Remove unchecked-unlock flag.
  (scm_make_recursive_mutex): Likewise.
  (fat_mutex_unlock): Remove unchecked-unlock case.
* test-suite/tests/threads.test: Remove unchecked-unlock test.
2016-11-05 10:30:54 +01:00
Andy Wingo
f1f68fffb1 Recursively locking a SRFI-18 mutex blocks
* libguile/threads.c (fat_mutex_lock): allow-external-unlock mutexes
  can't be recursive, but a recursive lock attempt can be unblocked by
  an external thread, so these mutexes shouldn't throw an error on
  recursive lock attempts.
* test-suite/tests/srfi-18.test: Add tests.
2016-11-05 10:30:54 +01:00
Andy Wingo
f1b7eaaa1a Remove fat mutex abandoned mutex error
* libguile/threads.c (fat_mutex_lock): Remove abandoned mutex error, as
  SRFI-18 is responsible for this.
* test-suite/tests/threads.test: Update test.
2016-11-05 10:30:49 +01:00
Andy Wingo
a3d0a7da4d Remove thread held pthread_mutex field
* libguile/threads.h (scm_i_thread):
* libguile/threads.c (guilify_self_1, on_thread_exit)
  (scm_pthread_cond_wait, scm_pthread_cond_timedwait): The thread-local
  held_mutex field is no longer needed, now that we cancel threads via
  interrupts instead of pthread_cancel.
2016-11-05 00:22:15 +01:00
Andy Wingo
857aa581a2 Remove thread-local weak mutex set
* libguile/threads.h (scm_i_thread):
* libguile/threads.c (guilify_self_1, do_thread_exit, fat_mutex_lock):
  Remove thread-local weak mutex set.
2016-11-05 00:20:39 +01:00
Andy Wingo
ecfa0b50ce Remove lock-mutex owner facility
* libguile/threads.c (scm_lock_mutex_timed): Deprecate "owner"
  argument.
  (fat_mutex_lock): Remove owner argument.
  (fat_mutex_unlock): Don't pass owner to scm_lock_mutex_timed.
* test-suite/tests/threads.test: Remove tests of mutex-owner.
2016-11-04 23:32:26 +01:00
Andy Wingo
0f5a59b215 try-mutex in terms of mutex-lock
* libguile/threads.c (scm_try_mutex): Just call scm_lock_mutex_timed
  with a zero timeout.
* module/ice-9/threads.scm (try-mutex): Likewise.
2016-11-02 21:29:30 +01:00
Andy Wingo
fcc6a7ba20 Deprecate critical sections
* NEWS: Deprecate critical sections.
* doc/ref/api-scheduling.texi (Critical Sections): Remove.
* libguile/async.c:
* libguile/async.h:
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/threads.c:
* libguile/threads.h: Deprecate critical section API.
2016-11-01 23:48:42 +01:00
Andy Wingo
4b78b001d8 Threads no longer track critical section level
* libguile/threads.h (scm_i_thread):
* libguile/threads.c (guilify_self_1): Remove critical_section_level
  member of scm_i_thread.
* libguile/async.c (scm_critical_section_end)
  (scm_critical_section_start): Remove bookkeeping.
2016-11-01 23:33:47 +01:00
Andy Wingo
b410667e64 Simplify critical section implementation
* libguile/async.h (SCM_CRITICAL_SECTION_START)
  (SCM_CRITICAL_SECTION_END): Define in just one way.
* libguile/async.c (critical_section_mutex): New static variable.
  (scm_critical_section_start, scm_critical_section_end): Inline
  internal body of critical section gates.
  (scm_init_async): Init critical_section_mutex.
* libguile/threads.c (scm_threads_prehistory): Don't declare critical
  section mutex here.
2016-11-01 22:48:19 +01:00
Andy Wingo
0a663877ac threads: Use a mutex instead of a critical section.
* libguile/threads.c: Replace uses of critical sections with a dedicated
  mutex.
2016-11-01 21:26:42 +01:00
Andy Wingo
eeeee3297b Remove thread cleanup facility
* NEWS: Add entry.
* doc/ref/api-scheduling.texi (Threads): Remove thread-cleanup docs.
* libguile/threads.c (guilify_self_1, do_thread_exit):
  (scm_set_thread_cleanup_x, scm_thread_cleanup): Remove these.
* libguile/threads.h (scm_i_thread): Remove cleanup_handler.
* module/ice-9/threads.scm:
* module/ice-9/deprecated.scm (thread-cleanup, set-thread-cleanup!):
  Remove.
* test-suite/tests/threads.test: Adapt to test cancel-thread return
  values and not test thread-cleanup procs.
2016-10-31 22:37:46 +01:00
Andy Wingo
a04739b31a cancel-thread via asyncs, not pthread_cancel
* module/ice-9/threads.scm (cancel-tag): New variable.
  (cancel-thread): New Scheme function.
  (call-with-new-thread): Install a prompt around the thread.
* libguile/threads.h (scm_i_thread): Remove cancelled member.
* libguile/threads.c (scm_cancel_thread): Call out to Scheme.  Always
  available, and works on the current thread too.
  (scm_set_thread_cleanup_x, scm_thread_cleanup): Adapt.
  (scm_init_ice_9_threads): Capture cancel-thread var.
* doc/ref/api-scheduling.texi (Threads): Update.
* NEWS: Update.
2016-10-27 21:22:28 +02:00
Andy Wingo
c957ec7ab0 Use atomics for async interrupts
* libguile/__scm.h (SCM_TICK): Always define as scm_async_tick().
* libguile/error.c (scm_syserror, scm_syserror_msg):
* libguile/fports.c (fport_read, fport_write):
* libguile/_scm.h (SCM_SYSCALL): Replace SCM_ASYNC_TICK with
  scm_async_tick ().
  (SCM_ASYNC_TICK, SCM_ASYNC_TICK_WITH_CODE)
  (SCM_ASYNC_TICK_WITH_GUARD_CODE): Remove internal definitions.  We
  inline into vm-engine.c, the only place where it matters.
* libguile/async.h:
* libguile/async.c (scm_async_tick, scm_i_setup_sleep):
  (scm_i_reset_sleep, scm_system_async_mark_for_thread):
* libguile/threads.h (struct scm_thread_wake_data):
* libguile/threads.h (scm_i_thread):
* libguile/threads.c (block_self, guilify_self_1, scm_std_select):
  Rewrite to use sequentially-consistent atomic references.
* libguile/atomics-internal.h (scm_atomic_set_pointer):
  (scm_atomic_ref_pointer): New definitions.
* libguile/finalizers.c (queue_finalizer_async): We can allocate, so
  just use scm_system_async_mark_for_thread instead of the set-cdr!
  shenanigans.
* libguile/scmsigs.c (take_signal):
* libguile/gc.c (queue_after_gc_hook): Adapt to new asyncs mechanism.
  Can't allocate but we're just manipulating the current thread when no
  other threads are running so we should be good.
* libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Inline the async_tick
  business.
2016-10-26 22:50:26 +02:00
Andy Wingo
f3bfe29235 Move call-with-new-thread to Scheme
* libguile/threads.c (scm_call_with_new_thread): Trampoline to Scheme.
  (launch_data, really_launch, scm_sys_call_with_new_thread): Simplify.
  (scm_init_ice_9_threads): Capture call-with-new-thread variable.
* module/ice-9/threads.scm (call-with-new-thread): Add implementation in
  Scheme.  Should allow for easier cancel-thread via prompt abort.
2016-10-26 22:50:26 +02:00
Andy Wingo
d74e0fed0d Move thread bindings to (ice-9 threads)
* libguile/init.c (scm_i_init_guile): Don't call scm_init_thread_procs.
* libguile/threads.c (scm_init_ice_9_threads): Rename from
  scm_init_thread_procs, make static.
  (scm_init_threads): Register scm_init_thread_procs extension.
* libguile/threads.h (scm_init_thread_procs): Remove decl.
* module/ice-9/boot-9.scm: Load (ice-9 threads), so that related side
  effects occur early.
* module/ice-9/deprecated.scm (define-deprecated): Fix to allow
  deprecated bindings to appear in operator position.  Export deprecated
  bindings.
  (define-deprecated/threads, define-deprecated/threads*): Trampoline
  thread bindings to (ice-9 threads).
* module/ice-9/futures.scm: Use ice-9 threads.
* module/ice-9/threads.scm: Load scm_init_ice_9_threads extension.
  Reorder definitions and imports so that the module circularity
  with (ice-9 futures) continues to work.
* module/language/cps/intmap.scm:
* module/language/cps/intset.scm:
* module/language/tree-il/primitives.scm: Use (ice-9 threads).
* module/language/cps/reify-primitives.scm: Reify current-thread
  in (ice-9 threads) module.
* module/srfi/srfi-18.scm: Use ice-9 threads with a module prefix, and
  adapt all users.  Use proper keywords in module definition form.
* test-suite/tests/filesys.test (test-suite):
* test-suite/tests/fluids.test (test-suite):
* test-suite/tests/srfi-18.test: Use ice-9 threads.
* NEWS: Add entry.
* doc/ref/api-scheduling.texi (Threads): Update.
* doc/ref/posix.texi (Processes): Move current-processor-count and
  total-processor-count docs to Threads.
2016-10-23 22:29:44 +02:00
Andy Wingo
105e36543f Remove scm_puts_unlocked.
* libguile/ports.h (scm_puts_unlocked): Remove.
* libguile/ports.c (scm_puts): Replace implementation with
  scm_puts_unlocked's implementation.
* libguile/arbiters.c:
* libguile/backtrace.c:
* libguile/bitvectors.c:
* libguile/continuations.c:
* libguile/deprecation.c:
* libguile/dynl.c:
* libguile/eval.c:
* libguile/filesys.c:
* libguile/fluids.c:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/frames.c:
* libguile/guardians.c:
* libguile/hashtab.c:
* libguile/hooks.c:
* libguile/load.c:
* libguile/macros.c:
* libguile/mallocs.c:
* libguile/print.c:
* libguile/programs.c:
* libguile/promises.c:
* libguile/smob.c:
* libguile/srcprop.c:
* libguile/srfi-14.c:
* libguile/stackchk.c:
* libguile/struct.c:
* libguile/threads.c:
* libguile/throw.c:
* libguile/values.c:
* libguile/variable.c:
* libguile/vm.c:
* libguile/weak-set.c:
* libguile/weak-table.c: Use scm_puts instead of scm_puts_unlocked.
2016-04-26 23:07:28 +02:00
Mark H Weaver
856d318a9f Merge branch 'stable-2.0'
Conflicts:
	benchmark-suite/benchmarks/ports.bm
	libguile/async.h
	libguile/bytevectors.c
	libguile/foreign.c
	libguile/gsubr.c
	libguile/srfi-1.c
	libguile/vm-engine.h
	libguile/vm-i-scheme.c
	module/Makefile.am
	module/language/tree-il/analyze.scm
	module/language/tree-il/peval.scm
	module/scripts/compile.scm
	module/scripts/disassemble.scm
	test-suite/tests/asm-to-bytecode.test
	test-suite/tests/peval.test
	test-suite/tests/rdelim.test
2014-09-30 03:50:47 -04:00
Ludovic Courtès
f184e887a6 build: Support pthread builds without 'pthread_cancel' support (Android).
Reported by Sylvain Beucler <beuc@beuc.net>.

* configure.ac: Check for 'pthread_cancel'.
* libguile/threads.c (scm_cancel_thread): Conditionalize on
  !SCM_USE_PTHREAD_THREADS || defined HAVE_PTHREAD_CANCEL.
* test-suite/tests/threads.test (require-cancel-thread): New procedure.
  ("timed joining fails if timeout exceeded", "join-thread returns
  timeoutval on timeout", "cancel succeeds", "handler result passed to
  join", "can cancel self"): Use it.
2014-07-04 15:52:53 +02:00
Mark H Weaver
475772ea57 Merge branch 'stable-2.0'
Conflicts:
	GUILE-VERSION
	NEWS
	guile-readline/ice-9/readline.scm
	libguile/async.c
	libguile/backtrace.c
	libguile/deprecated.h
	libguile/gc-malloc.c
	libguile/gdbint.c
	libguile/init.c
	libguile/ioext.c
	libguile/mallocs.c
	libguile/print.c
	libguile/rw.c
	libguile/scmsigs.c
	libguile/script.c
	libguile/simpos.c
	libguile/snarf.h
	libguile/strports.c
	libguile/threads.c
	libguile/vm-i-scheme.c
	libguile/vm-i-system.c
	module/srfi/srfi-18.scm
	test-suite/Makefile.am
	test-suite/standalone/test-num2integral.c
2014-04-25 02:06:01 -04:00
Mark H Weaver
bc8e6d7d8c Rely on Gnulib for <unistd.h>.
* libguile/async.c:
* libguile/backtrace.c:
* libguile/error.c:
* libguile/filesys.c:
* libguile/fports.c:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/gdbint.c:
* libguile/init.c:
* libguile/ioext.c:
* libguile/load.c:
* libguile/mallocs.c:
* libguile/mkstemp.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/r6rs-ports.c:
* libguile/random.c:
* libguile/rw.c:
* libguile/scmsigs.c:
* libguile/script.c:
* libguile/simpos.c:
* libguile/socket.c:
* libguile/stime.c:
* libguile/strports.c:
* libguile/threads.c: Unconditionally include <unistd.h>.
2014-02-27 22:38:48 -05:00
Andy Wingo
c65ea594e9 Fix segfault in thread_mark
* libguile/threads.c (thread_mark): There is a window in which the
  thread has a handle but doesn't yet have the set of pointerless
  freelists, so don't unconditionally dereference
  t->pointerless_freelists.
2014-02-21 14:42:24 +01:00
Mark H Weaver
e1d7a93bb2 Rely on Gnulib for 'select', 'lstat', and 'mkstemp'.
* libguile/iselect.h:
* libguile/threads.c:
* libguile/deprecated.h: Rely on Gnulib for sys/select.h.

* libguile/filesys.c: Rely on Gnulib for 'lstat' and 'mkstemp'.
2014-02-12 20:53:29 -05:00
Andy Wingo
aef1fcf94e Add thread-local lock-free, TLS-free freelists.
* libguile/bdw-gc.h: Remove a needless compatibility hack.

* libguile/gc-inline.h: New file, implementing thread-local freelists
  providing faster allocation if we already have a scm_i_thread*
  pointer.  Based on gc_inline.h from libgc.

* libguile/threads.h (scm_i_thread): Add freelists here.
* libguile/threads.c (guilify_self_1, guilify_self_2): Initialize
  freelists.

* libguile/vm.c: Include gc-inline.h.
* libguile/vm-engine.c: Rename current_thread to thread.  Use
  scm_inline_cons instead of scm_cons, scm_inline_cell instead of
  scm_cell, and scm_inline_words instead of words.
2014-02-02 16:17:54 +01:00
Andy Wingo
f76cf73a49 Merge commit '8571dbde63'
Conflicts:
	libguile/procprop.c
2013-11-28 15:00:17 +01:00
Mark H Weaver
e676a4c342 Add mutex locking functions that also block asyncs.
* libguile/async.h (scm_i_pthread_mutex_lock_block_asyncs,
  scm_i_pthread_mutex_unlock_unblock_asyncs): New macros.

* libguile/threads.c (do_unlock_with_asyncs): New static helper.
  (scm_i_dynwind_pthread_mutex_lock_block_asyncs): New function.

* libguile/threads.h (scm_i_dynwind_pthread_mutex_lock_block_asyncs):
  Add prototype.
2013-11-23 14:39:51 -05:00
Andy Wingo
5f18bc8450 Allocate stacks using mmap, and mark them via the thread marker
* libguile/threads.c (thread_mark): Mark the VM stack, if we have one.
  (on_thread_exit): Free the VM stack here.

* libguile/vm.c (make_vm): Allocate the VM stack using mmap, and arrange
  for it to be marked by the thread marker.
  (scm_i_vm_mark_stack, scm_i_vm_free_stack): New internal interfaces.
  (allocate_stack, free_stack): New helpers.
2013-11-22 14:41:19 +01:00
Andy Wingo
7af0c3b395 Add thread mark procedure
* libguile/threads.c (thread_mark): A mark procedure for threads.
  Eventually will mark the stack.
  (guilify_self_1): Move initialization of VP earlier.  Allocate thread
  using thread_gc_kind.
  (scm_threads_prehistory): Initialize thread_gc_kind.
2013-11-22 13:01:53 +01:00
Andy Wingo
9ebf794607 Remove unused scm_i_thread fields
* libguile/threads.h (scm_i_thread):
* libguile/threads.c (guilify_self_1): Remove unused mark stack fields.
2013-11-22 10:59:14 +01:00
Andy Wingo
03d1294977 Remove tests and shims for pre-7.2 bdw-gc.
* configure.ac: Remove checks for symbols present in bdw-gc 7.2.

* libguile/finalizers.c:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/guardians.c:
* libguile/scmsigs.c:
* libguile/threads.c: Remove shims.
2013-11-22 10:51:56 +01:00
Andy Wingo
3506b1521e Remove last use of SCM vm
* libguile/threads.h (scm_i_thread): Hold a struct scm_vm*, not a SCM
  vm.
* libguile/threads.c (guilify_self_2):
* libguile/vm.c (make_vm): Adapt.
2013-11-21 18:33:06 +01:00
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