This fixes lots of helgrind-reported problems, such as:
Thread #1: lock order "0x4325084 before 0x4108928" violated
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x40CFD37: scm_enter_guile (threads.c:377)
by 0x40D0284: scm_pthread_mutex_lock (threads.c:1485)
by 0x405A736: scm_async_click (async.c:155)
by 0x406F9EE: deval (eval.c:4080)
by 0x40761D9: scm_primitive_eval_x (eval.c:5921)
by 0x40AD20E: install_handler (scmsigs.c:113)
by 0x40AD402: scm_sigaction_for_thread (scmsigs.c:394)
by 0x4087D1F: scm_gsubr_apply (gsubr.c:223)
by 0x406DF55: scm_dapply (eval.c:4930)
by 0x407147C: deval (eval.c:4378)
by 0x406E1BD: scm_dapply (eval.c:5012)
Required order was established by acquisition of lock at 0x4325084
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x40CFD37: scm_enter_guile (threads.c:377)
by 0x408C58B: scm_i_init_guile (init.c:421)
by 0x40D1873: scm_i_init_thread_for_guile (threads.c:589)
by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:731)
by 0x40D19BD: scm_with_guile (threads.c:720)
by 0x408C42E: scm_boot_guile (init.c:350)
by 0x8048710: main (guile.c:69)
followed by a later acquisition of lock at 0x4108928
at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408)
by 0x40AFD61: scm_make_smob_type (smob.c:294)
by 0x40AFF19: scm_smob_prehistory (smob.c:512)
by 0x408C595: scm_i_init_guile (init.c:423)
by 0x40D1873: scm_i_init_thread_for_guile (threads.c:589)
by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:731)
by 0x40D19BD: scm_with_guile (threads.c:720)
by 0x408C42E: scm_boot_guile (init.c:350)
by 0x8048710: main (guile.c:69)
* libguile/async.c (scm_async_click): Don't leave Guile mode when
locking async_mutex. We don't need to, because none of the code
that has async_mutex locked can block, and doing so may lead to lock
ordering problems between async_mutex and a thread's heap_mutex.
This fixes bug #24009 reported by Martin Pitt.
* libguile/threads.c (guilify_self_1): Check the return value of
pipe(2).
(scm_std_select): Store the return value of read(2) when reading
from WAKEUP_FD.
* libguile/async.c (scm_i_queue_async_cell): Store the return value
of write(2) when writing to SLEEP_FD.
* libguile/fports.c (fport_flush): Likewise.
* libguile/posix.c (getgroups): Use the return value of getgroups(2) as
NGROUPS.
(scm_nice): Get the return value of nice(2) to make glibc happy.
* libguile/scmsigs.c (take_signal): Store the return value of
write(2).
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.
signal_asyncs. Don't set cdr of a non-signal async to #f.
(scm_i_queue_async_cell): Do not check cdr of cell for #f, queue
always. Set pending_asyncs.
(scm_system_async_mark_for_thread): Check that thread has not
exited.
(scm_unmask_signals, decrease_block): Call scm_async_click after
block_asyncs becomes zero.
scm_i_thread_root when USE_THREADS is defined. Use scm_root
otherwise.
* scmsigs.c (take_signal): Only call scm_i_thread_root when
USE_THREADS is defined. Use scm_root otherwise.
(scm_sigaction_for_thread): Ignore THREAD argument when
USE_THREADS is not defined. Also, move THREAD argument defaulting
out of HAVE_SIGACTION section, which was a bug.
scm_call_with_unblocked_asyncs, scm_c_call_with_blocked_asyncs,
scm_c_call_with_unblocked_asyncs): New prototypes.
(scm_mask_signals, scm_unmask_signals): Deprecated.
(scm_mask_ints): Turned into a macro.
* async.c (scm_mask_ints): Removed.
(scm_run_asyncs): Do not set scm_mask_ints while running an async.
this should not be necessary.
(scm_async_click): Test block_asyncs instead of scm_mask_ints.
(scm_mask_signals, scm_unmask_signals): Deprecated. Emit
deprecation warning and check for errornous use. Set block_asyncs
instead of scm_mask_ints.
(increase_block, decrease_block, scm_call_with_blocked_asyncs,
scm_call_with_unblocked_asyncs, scm_c_call_with_blocked_asyncs,
scm_c_call_with_unblocked_asyncs): New.
cell to SCM_BOOL_F, not SCM_EOL.
(scm_i_queue_async_cell): Queue the cell at the end of the list,
and only if the handler procedure is not already present.
(scm_system_async_mark_for_thread): Initialize cdr of handler cell
with SCM_BOOL_F.
* scmsigs.c (scm_sigaction_for_thread): Likewise.
* *.c: add space after commas everywhere.
* *.c: use SCM_VECTOR_SET everywhere, where a vector is written.
Document cases where SCM_WRITABLE_VELTS() is used.
* vectors.h (SCM_VELTS): prepare for write barrier, and let
SCM_VELTS() return a const pointer
(SCM_VECTOR_SET): add macro.
* autogen.sh (mscripts): find and check version number of
autoconf. Complain if 2.53 is not found.
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.)