| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
Run admin/update-copyright in the master branch. This fixes files
that were not already fixed in the emacs-25 branch before it was
merged here.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This avoids the confusion of using two different phrases "main thread"
and "primary thread" internally to mean the same thing. See:
http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg01142.html
* src/thread.c (main_thread): Rename from primary_thread,
since the new name no longer clashes with main_thread_id
and Emacs internals normally call this the "main thread".
(init_main_thread): Rename from init_primary_thread.
(main_thread_p): Rename from primary_thread_p.
All uses changed.
|
| |
|
|
|
|
|
| |
* src/dired.c, src/emacs.c, src/search.c, src/syntax.c, src/thread.h:
Do not include sys/types.h; no longer needed.
* src/regex.h: Include <sys/types.h>, as that's what Gnulib and
glibc regex.h does, and POSIX has blessed this since 2008.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This puts basic functions for types to be after the corresponding
type definitions. This is a more-common programming style in C,
and will make it easier to port Emacs to gcc
-fcheck-pointer-bounds, since the functions now have access to the
corresponding types' sizes. This patch does not change the code;
it just moves declarations and definitions and removes
no-longer-needed forward declarations (Bug#25128).
* src/buffer.c, src/data.c, src/image.c:
Include process.h, for PROCESSP.
* src/buffer.h (BUFFERP, CHECK_BUFFER, XBUFFER):
* src/process.h (PROCESSP, CHECK_PROCESS, XPROCESS):
* src/termhooks.h (TERMINALP, XTERMINAL):
* src/window.h (WINDOWP, CHECK_WINDOW, XWINDOW):
* src/thread.h (THREADP, CHECK_THREAD, XTHREAD, MUTEXP, CHECK_MUTEX)
(XMUTEX, CONDVARP, CHECK_CONDVAR, XCONDVAR):
Move here from lisp.h.
* src/intervals.h: Include buffer.h, for BUFFERP.
Include lisp.h, for Lisp_Object.
* src/lisp.h: Reorder declarations and definitions as described
above. Move thread includes to be later, so that they can use the
reordered definitions. Move some symbols to other headers (noted
elsewhere). Remove forward decls that are no longer needed.
* src/thread.h: Include systhread.h here, not in lisp.h,
since lisp.h itself does not need systhread.h.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This improves performance overall on my benchmark on x86-64,
since the interpreted program-counter resides in a machine
register rather than in RAM.
* etc/DEBUG, src/.gdbinit: Remove xbytecode GDB command, as there
is no longer a byte stack to decode.
* src/bytecode.c (struct byte_stack, byte_stack_list)
(relocate_byte_stack): Remove. All uses removed.
(FETCH): Simplify now that pc is now local (typically, in a
register) and no longer needs to be relocated.
(CHECK_RANGE): Remove. All uses now done inline, in a different way.
(BYTE_CODE_QUIT): Remove; now done by op_relative_branch.
(exec_byte_code): Allocate a copy of the function’s bytecode,
so that there is no problem if GC moves it.
* src/lisp.h (struct handler): Remove byte_stack member.
All uses removed.
* src/thread.c (unmark_threads): Remove. All uses removed.
* src/thread.h (struct thread_state): Remove m_byte_stack_list member.
All uses removed. m_stack_bottom is now the first non-Lisp field.
|
| | |
|
| |
|
|
|
|
|
| |
* src/thread.c (primary_thread_p): New function.
* src/alloc.c (mark_object): Use 'primary_thread_p' to bypass tests
meant for thread objects allocated dynamically.
* src/thread.h (primary_thread_p): Add prototype.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/thread.h (struct thread_state): New member not_holding_lock.
(maybe_reacquire_global_lock): Add prototype.
* src/thread.c: Include syssignal.h.
(maybe_reacquire_global_lock): New function.
(really_call_select): Set the not_holding_lock member of the
thread state before releasing the lock, and rest it after
re-acquiring the lock when the select function returns. Block
SIGINT while doing this to make sure we are not interrupted on TTY
frames.
* src/sysdep.c (block_interrupt_signal, restore_signal_mask): New
functions.
* src/syssignal.h (block_interrupt_signal, restore_signal_mask):
Add prototypes.
* src/keyboard.c (read_char) [THREADS_ENABLED]: Call
maybe_reacquire_global_lock. (Bug#25178)
|
| |
|
|
|
|
| |
* src/thread.h (struct thread_state): Fix comments.
* src/process.c (wait_reading_process_output): Fix a typo in
commentary.
|
| |
|
|
|
|
|
| |
* src/thread.h:
* src/keyboard.c:
* src/keyboard.h: Undo part of last change:
input_available_clear_time is again a global variable.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* src/thread.h (struct thread_state): Add members
m_waiting_for_input and m_input_available_clear_time.
(waiting_for_input, input_available_clear_time): New macros.
* src/keyboard.c (waiting_for_input, input_available_clear_time):
Remove; they are now macros that reference the current thread.
(Bug#25171)
* src/w32select.c: Don't include keyboard.h.
* test/src/thread-tests.el (thread-errors): New test.
|
| | |
|
| |
|
|
|
|
|
|
| |
* src/thread.h <int select_func>: Make the 5th and 6th arguments
be 'const'.
* src/process.c [WINDOWSNT]:
* src/w32proc.c: Make the 5th and 6th argument to sys_select be
'const'.
|
| |
|
|
|
| |
* src/thread.h: Include sys/types.h, for ssize_t that regex.h
uses. Reported by Robert Marshall <robert.marshall@codethink.co.uk>.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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/thread.h [WINDOWSNT]: Include sys/socket.h.
* src/sysselect.h: Don't define fd_set and FD_* macros for
MS-Windows here.
* src/w32.h: Define them here.
* src/process.h (sys_select): Declare prototype.
* src/sysdep.c:
* src/process.c:
* src/filelock.c:
* src/emacs.c:
* src/callproc.c: Move inclusion of sys/select.h after lisp.h.
* nt/inc/socket.h: Include w32.h instead of sysselect.h
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
this merges frmo trunk and fixes various build issues.
this needed a few ugly tweaks.
this hangs in "make check" now
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
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.
|