| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/thread.c (post_acquire_global_lock): Call
set_buffer_internal_2 instead of tricking set_buffer_internal_1
into resetting the current buffer even if it didn't change. This
avoids bug#25165, caused by failing to record the modified values
of point and mark, because current_buffer was set to NULL. Also,
don't bother re-setting the buffer if there was no thread switch,
as that just wastes cycles.
* src/buffer.c (set_buffer_internal_2): New function, with most of
the body of set_buffer_internal_1, but without the test for B
being identical to the current buffer.
(set_buffer_internal_1): Call set_buffer_internal_2 if B is not
identical to the current buffer.
* src/buffer.h (set_buffer_internal_2): Add prototype.
* test/src/thread-tests.el (thread-sticky-point): New test.
|
| | |
|
| |
|
|
|
| |
* src/thread.c (lisp_mutex_unlock, Fcondition_wait)
(Fcondition_notify, Fthread_join): Fix error messages.
|
| |
|
|
|
|
| |
* src/thread.c (Fmake_condition_variable, Fcondition_wait)
(Fcondition_notify, Fcondition_mutex, Fcondition_name, Fmake_thread)
(Fthread_join, Fall_threads): Doc fixes.
|
| |
|
|
|
|
| |
* src/thread.c (mark_one_thread): Use NILP to compare with
m_saved_last_thing_searched, which is a Lisp object. Reported by
Andreas Politz <politza@hochschule-trier.de>.
|
| |
|
|
|
| |
* src/thread.c (Fmake_thread): Call emacs_abort, to avoid
compilation warning.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Conflicts (resolved):
configure.ac
src/Makefile.in
src/alloc.c
src/bytecode.c
src/emacs.c
src/eval.c
src/lisp.h
src/process.c
src/regex.c
src/regex.h
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
src/eval.c (unbind_for_thread_switch): Accept a 'struct
thread_state *' argument and use specpdl_ptr and specpdl of that
thread. Fixes crashes if find_symbol_value signals an error.
src/thread.c (post_acquire_global_lock): Update current_thread
before calling unbind_for_thread_switch. Pass the previous thread
to unbind_for_thread_switch.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
this fixes run_thread to account for the dummy slot
in specpdl
|
| |
|
|
|
|
| |
this merges frmo trunk and fixes various build issues.
this needed a few ugly tweaks.
this hangs in "make check" now
|
| | |
|
| |
|
|
|
| |
this tweaks thread.c to use 'self' instead of current_thread
in a couple spots. this is clearer and more robust
|
| |
|
|
|
| |
unlink thread from global list later
also remove some unnecessary destruction code
|
| |
|
|
|
|
| |
This introduces the thread_alive_p macro and changes
thread-alive-p to use it. This is a minor cleanup.
It also changes all-threads to ignore dead threads.
|
| |
|
|
|
| |
This removes the call to unbind_for_thread_switch from run_thread.
This isn't necessary because acquire_global_lock does it properly.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* we called unbind_for_thread_switch unconditionally, but this
is wrong if the previous thread exited
* likewise, exiting a thread should clear current_thread
* redundant assignment in run_thread
* clean up init_threads - no need to re-init the primary thread
This patch still sometimes causes weird hangs in "make check".
However, I think that is a kernel bug, since Emacs enters the zombie
state but its parent process hangs in wait. This shouldn't happen.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
use prctl to pass the thread name to the OS, if possible
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
This implements condition variables for elisp.
This needs more tests.
|
| |
|
|
|
|
| |
This refactors systhread.h to move the notion of a "lisp mutex"
into thread.c. This lets us make make the global lock and
post_acquire_global_lock static.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes wait_reading_process_output to handle threads better. It
introduces a wrapper for select that releases the global lock, and it
ensures that only a single thread can select a given file descriptor
at a time.
This also adds the thread-locking feature to processes. By default a
process can only have its output accepted by the thread that created
it. This can be changed using set-process-thread. (If the thread
exits, the process is again available for waiting by any thread.)
Note that thread-signal will not currently interrupt a thread blocked
on select. I'll fix this later.
|
| |
|
|
| |
blocked on. I thought this would be another nice debugging addition.
|
| |
|
|
| |
extension.
|
| |
|
|
|
|
|
| |
A lisp mutex is implemented using a condition variable, so that we can
interrupt a mutex-lock operation by calling thread-signal on the
blocking thread. I did things this way because pthread_mutex_lock
can't readily be interrupted.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I roughly followed the Bordeaux threads API:
http://trac.common-lisp.net/bordeaux-threads/wiki/ApiDocumentation
... but not identically. In particular I chose not to implement
interrupt-thread or destroy-thread, but instead a thread-signalling
approach.
I'm still undecided about *default-special-bindings* (which I did not
implement). I think it would be more emacs-like to capture the let
bindings at make-thread time, but IIRC Stefan didn't like this idea
the first time around.
There are one or two semantics issues pointed out in the patch where I
could use some advice.
|
| |
|
|
| |
of Emacs to cope.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
idea is that when a thread loses the interpreter lock, it will unbind
the bindings it has put in place. Then when a thread acquires the
lock, it will restore its bindings.
This code reuses an existing empty slot in struct specbinding to store
the current value when the thread is "swapped out".
This approach performs worse than my previously planned approach.
However, it was one I could implement with minimal time and
brainpower. I hope that perhaps someone else could improve the code
once it is in.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the global lock. The low-level support is a bit over-eager, in that
even at the end of the present series, it will not all be used. I
think thiat is ok since I plan to use it all eventually -- in
particular for the emacs lisp mutex implementation.
I've only implemented the pthreads-based version. I think it should
be relatively clear how to port this to other systems, though.
I'd also like to do a "no threads" port that will turn most things
into no-ops, and have thread-creation fail. I was thinking perhaps
I'd make a future (provide 'threads) conditional on threads actually
working.
One other minor enhancement available here is to make it possible to
set the name of the new thread at the OS layer. That way gdb, e.g.,
could display thread names.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The basic idea is that whenever a thread "exits lisp" -- that is,
releases the global lock in favor of another thread -- it must save
its stack boundaries in the thread object. This way the boundaries
are always available for marking. This is the purpose of
flush_stack_call_func.
I haven't tested this under all the possible GC configurations.
There is a new FIXME in a spot that i didn't convert.
Arguably all_threads should go in the previous patch.
|
|
|
there. It also introduces #defines for these globals to avoid a
monster patch.
The #defines mean that this patch also has to rename a few fields
whose names clash with the defines.
There is currently just a single "thread"; so this patch does not
impact Emacs behavior in any significant way.
|