aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.