aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix point motion in cloned buffersEli Zaretskii2016-12-121-6/+5
| | | | | | | | | | | | | | | | | | * 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.
* ; Fix copyright years in new filesGlenn Morris2016-12-101-1/+1
|
* Fix error messages in thread.cEli Zaretskii2016-12-101-4/+4
| | | | | * src/thread.c (lisp_mutex_unlock, Fcondition_wait) (Fcondition_notify, Fthread_join): Fix error messages.
* Improve doc strings in thread.cEli Zaretskii2016-12-101-30/+31
| | | | | | * src/thread.c (Fmake_condition_variable, Fcondition_wait) (Fcondition_notify, Fcondition_mutex, Fcondition_name, Fmake_thread) (Fthread_join, Fall_threads): Doc fixes.
* Fix building with check-lisp-object-typeEli Zaretskii2016-12-101-1/+1
| | | | | | * 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>.
* Fix compilation warningsEli Zaretskii2016-12-081-1/+1
| | | | | * src/thread.c (Fmake_thread): Call emacs_abort, to avoid compilation warning.
* Fix compilation problems.Eli Zaretskii2016-12-051-6/+0
|
* Merge branch 'concurrency'Eli Zaretskii2016-12-041-2/+1
| | | | | | | | | | | | | | 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
* merge from trunkKen Raeburn2015-11-011-39/+41
|
* change condition-variablep to condition-variable-pTom Tromey2013-10-171-3/+3
|
* Fix crashes when unbind_for_thread_switch signals an error.Eli Zaretskii2013-09-011-5/+10
| | | | | | | | | 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.
* rename thread-blocker to thread--blockerTom Tromey2013-08-271-1/+1
|
* make thread_check_current_buffer return boolTom Tromey2013-08-271-3/+3
|
* use record_unwind_protect_void, avoid warningTom Tromey2013-08-261-4/+3
|
* implement --enable-threads and a thread-less modeTom Tromey2013-08-261-18/+23
|
* Use thread_alive_p in a couple more spotsTom Tromey2013-07-111-2/+2
|
* fix xfree bug in run_threadTom Tromey2013-07-071-1/+1
| | | | | this fixes run_thread to account for the dummy slot in specpdl
* merge from trunkTom Tromey2013-07-061-2/+4
| | | | | | this merges frmo trunk and fixes various build issues. this needed a few ugly tweaks. this hangs in "make check" now
* call init_primary_thread from init_threadsTom Tromey2013-07-061-0/+1
|
* avoid current_thread sometimesTom Tromey2013-07-041-2/+3
| | | | | this tweaks thread.c to use 'self' instead of current_thread in a couple spots. this is clearer and more robust
* unlink thread laterTom Tromey2013-07-031-11/+8
| | | | | unlink thread from global list later also remove some unnecessary destruction code
* introduce thread_alive_p macroTom Tromey2013-07-031-6/+13
| | | | | | 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.
* Don't call unbind_for_thread_switch in run_threadTom Tromey2013-07-031-2/+0
| | | | | This removes the call to unbind_for_thread_switch from run_thread. This isn't necessary because acquire_global_lock does it properly.
* fix a few latent issues in the thread patchTom Tromey2013-06-061-6/+10
| | | | | | | | | | | | * 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.
* merge from trunk; clean up some issuesTom Tromey2013-06-031-10/+2
|
* don't let kill-buffer kill a buffer if it is current in any threadTom Tromey2013-03-181-0/+19
|
* cannot thread-join the current threadTom Tromey2012-08-271-0/+3
|
* pass the thread name to the OS if possibleTom Tromey2012-08-201-1/+6
| | | | use prctl to pass the thread name to the OS, if possible
* another docstring fixletTom Tromey2012-08-191-1/+2
|
* minor docstring fixupTom Tromey2012-08-191-4/+4
|
* add condition-mutex and condition-nameTom Tromey2012-08-191-0/+27
|
* ensure name of a thread is a stringTom Tromey2012-08-191-0/+3
|
* ensure name of a mutex is a stringTom Tromey2012-08-191-0/+3
|
* use NILPTom Tromey2012-08-191-3/+3
|
* condition variablesTom Tromey2012-08-191-18/+201
| | | | | This implements condition variables for elisp. This needs more tests.
* refactor systhread.hTom Tromey2012-08-181-46/+108
| | | | | | 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.
* write docstrings for the thread functionsTom Tromey2012-08-171-26/+54
|
* declare unbind_for_thread_switch and rebind_for_thread_switch in lisp.hTom Tromey2012-08-171-4/+0
|
* process changesTom Tromey2012-08-151-0/+47
| | | | | | | | | | | | | | | 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.
* This adds thread-blocker, a function to examine what a thread isTom Tromey2012-08-151-1/+30
| | | | blocked on. I thought this would be another nice debugging addition.
* This adds names to mutexes. This seemed like a nice debuggingTom Tromey2012-08-151-9/+16
| | | | extension.
* This supplies the mutex implementation for Emacs Lisp.Tom Tromey2012-08-151-1/+82
| | | | | | | 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.
* This adds most of the thread features visible to emacs lisp.Tom Tromey2012-08-151-8/+346
| | | | | | | | | | | | | | | | | | 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.
* This turns thread_state into a pseudovector and updates various bitsTom Tromey2012-08-151-3/+19
| | | | of Emacs to cope.
* This introduces some new functions to handle the specpdl. The basicTom Tromey2012-08-151-0/+1
| | | | | | | | | | | | | | 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.
* This introduces the low-level system threading support. It also addsTom Tromey2012-08-151-0/+9
| | | | | | | | | | | | | | | | | | | 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.
* This parameterizes the GC a bit to make it thread-ready.Tom Tromey2012-08-151-0/+79
| | | | | | | | | | | | | 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.
* This introduces a thread-state object and moves various C globalsTom Tromey2012-08-151-0/+26
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.