aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* | Fix crashes upon C-g on Posix TTY framesEli Zaretskii2016-12-195-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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)
* | Fix commentsEli Zaretskii2016-12-172-4/+4
| | | | | | | | | | | | * src/thread.h (struct thread_state): Fix comments. * src/process.c (wait_reading_process_output): Fix a typo in commentary.
* | Fix crashes on MS-Windows during dumpingEli Zaretskii2016-12-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/unexw32.c (get_section_info): Make extra_bss_size be the maximum of extra_bss_size and extra_bss_size_static. This avoids computing the size of the output file smaller than it actually needs to be, which then causes copy_executable_and_dump_data to write beyond the requested size of the file mapping, thus relying on the OS roundup to page boundary to save us from ourselves. See http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00642.html for the details. * lib/stdio-impl.h: Revert the workaround fix of not including errno.h for MinGW.
* | Prevent crashes in xg_select due to concurrencyEli Zaretskii2016-12-151-1/+1
| | | | | | | | | | | | | | | | * src/xgselect.c (xg_select): Don't call Glib functions that use 'context' if we failed to acquire it. This means some other thread owns the context, in which case both using the context and calling block_input/unblock_input will step on that thread's toes and eventually lead to crashes. (Bug#25172)
* | Replace ldefs-boot with a much smaller filePhillip Lord2016-12-134-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile.in (bootstrap-build,generate-ldefs-boot): New targets. (bootstrap): Depend on bootstrap-build. * admin/ldefs-clean.el: New file. * lisp/Makefile.in (compile-first): Depend on loaddefs.el * lisp/ldefs-boot.el: Remove. * lisp/ldefs-boot-auto.el: New file. * lisp/ldefs-boot-manual.el: New file. * lisp/loadup.el: Load ldefs-boot-manual.el. * src/emacs.c (generating_ldefs_boot): New variable. (main): Check whether we are generating ldefs. * src/eval.c (autoload-do-load): Dump autoload forms to stderr when requested. * src/lisp.h (generating_ldefs_boot): New variable. * admin/gitmerge.el, admin/make-tarball.txt, admin/notes/copyright, lisp/Makefile.in, lisp/cus-dep.el, lisp/emacs-lisp/elint.el, lisp/finder.el, lisp/loadup.el, msdos/mainmake.v2: Update reference to ldefs-boot. * admin/update_autogen: Alter mechanism for ldefs-boot generation.
* | Clean up var watcher disabling on thread switchingNoam Postavsky2016-12-123-51/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/data.c (Fset_default): Move code into new C level function, `set_default_internal'. (set_default_internal): New function, like `Fset_default' but also takes additional bindflag parameter. (set_internal): Only call `notify_variable_watchers' if bindflag is not SET_INTERNAL_THREAD_SWITCH. * src/eval.c (do_specbind, do_one_unbind): Add bindflag parameter, passed on to set_internal and set_default_internal. Adjust callers. (rebind_for_thread_switch, unbind_for_thread_switch): Pass SET_INTERNAL_THREAD_SWITCH to do_specbind, do_one_unbind instead of temporarily adjusting symbol's trapped_write field.
* | Move backtrace to ELisp using a new mapbacktrace primitiveClément Pit--Claudel2016-12-121-88/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/eval.c (get_backtrace_starting_at, backtrace_frame_apply) (Fmapbacktrace, Fbacktrace_frame_internal): New functions. (get_backtrace_frame, Fbacktrace_debug): Use `get_backtrace_starting_at'. * lisp/subr.el (backtrace--print-frame): New function. (backtrace): Reimplement using `backtrace--print-frame' and `mapbacktrace'. (backtrace-frame): Reimplement using `backtrace-frame--internal'. * lisp/emacs-lisp/debug.el (debugger-setup-buffer): Pass a base to `mapbacktrace' instead of searching for "(debug" in the output of `backtrace'. * test/lisp/subr-tests.el (subr-test-backtrace-simple-tests) (subr-test-backtrace-integration-test): New tests. * doc/lispref/debugging.texi (Internals of Debugger): Document `mapbacktrace' and missing argument BASE of `backtrace-frame'.
* | Use C99 syntax for font driversPaul Eggert2016-12-127-117/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem reported by Daniel Colascione in: http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00515.html * src/ftcrfont.c (ftcrfont_driver): * src/ftfont.c (ftfont_driver): * src/ftxfont.c (ftxfont_driver): * src/macfont.m (macfont_driver): * src/nsfont.m (nsfont_driver): * src/xfont.c (xfont_driver): * src/xftfont.c (xftfont_driver): Use C99 syntax, not the old GNU C syntax.
* | Un-revert recent Ffset changeGlenn Morris2016-12-121-0/+3
| | | | | | | | * src/data.c (Ffset): Reinstate the check for "nil".
* | Avoid crashing if a new thread is signaled right awayEli Zaretskii2016-12-121-11/+15
| | | | | | | | | | | | | | | | | | | | | | * src/thread.c (post_acquire_global_lock): Don't raise the pending signal if the thread's handlers were not yet set up, as that will cause Emacs to exit with a fatal error. This can happen if a thread is signaled as soon as make-thread returns, before the new thread had an opportunity to acquire the global lock, set up the handlers, and call the thread function. * test/src/thread-tests.el (thread-signal-early): New test.
* | Fix point motion in cloned buffersEli Zaretskii2016-12-123-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Undo part of last changeEli Zaretskii2016-12-113-5/+8
| | | | | | | | | | | | | | * src/thread.h: * src/keyboard.c: * src/keyboard.h: Undo part of last change: input_available_clear_time is again a global variable.
* | Avoid aborts when a thread signals an errorEli Zaretskii2016-12-114-15/+9
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Revert earlier Ffset changeGlenn Morris2016-12-101-3/+0
| | | | | | | | | | * src/data.c (Ffset): Allow nil again, since it caused eager macro-expansion failures.
* | Do not allow nil to be defined as a functionGlenn Morris2016-12-101-0/+3
| | | | | | | | | | * lisp/emacs-lisp/byte-run.el (defun): * src/data.c (Ffset): Do not allow "nil". (Bug#25110)
* | ; Fix copyright years in new filesGlenn Morris2016-12-104-4/+4
| |
* | Support concurrency in Emacs LispEli Zaretskii2016-12-1025-444/+2776
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge branch 'test-concurrency' * src/thread.c: * src/thread.h: * src/systhread.c: * src/systhread.h: New files. * src/xgselect.c (xg_select): Avoid using SAFE_NALLOCA and use xnmalloc unconditionally. * src/window.c (struct save_window_data): Rename current_buffer to f_current_buffer. * src/w32proc.c (sys_select): Change the function signature to closer fit 'pselect' on Posix hosts. * src/search.c: * src/regex.h: Convert some globals to macros that reference thread-specific values. * src/process.c (pset_thread, add_non_keyboard_read_fd) (add_process_read_fd, add_non_blocking_write_fd) (recompute_input_desc, compute_input_wait_mask) (compute_non_process_wait_mask, compute_non_keyboard_wait_mask) (compute_write_mask, clear_waiting_thread_info) (update_processes_for_thread_death, Fset_process_thread) (Fprocess_thread): New functions. (enum fd_bits): New enumeration. (fd_callback_data): Add 'thread' and 'waiting_thread', rename 'condition' to 'flags'. (set_process_filter_masks, create_process, create_pty) (Fmake_serial_process, finish_after_tls_connection) (connect_network_socket, deactivate_process) (server_accept_connection, wait_reading_process_output) (Fcontinue_process, Fstop_process, keyboard_bit_set) (add_timer_wait_descriptor, add_keyboard_wait_descriptor) (delete_keyboard_wait_descriptor): Use the new functions instead of manipulating fd flags and masks directly. (syms_of_process): Defsubr the new primitives. * src/print.c (print_object): Print threads, mutexes, and conditional variables. * src/lisp.h (enum pvec_type): New values PVEC_THREAD, PVEC_MUTEX, and PVEC_CONDVAR. (XTHREAD, XMUTEX, XCONDVAR, THREADP, MUTEXP, CONDVARP) (CHECK_THREAD, CHECK_MUTEX, CHECK_CONDVAR): New inline functions. (XSETTHREAD, XSETMUTEX, XSETCONDVAR): New macros. (struct handler): Add back byte_stack. Rename lisp_eval_depth to f_lisp_eval_depth. * src/eval.c (specpdl_kind, specpdl_arg, do_specbind) (rebind_for_thread_switch, do_one_unbind) (unbind_for_thread_switch): New functions. (init_eval): 'handlerlist' is not malloc'ed. (specbind): Call do_specbind. (unbind_to): Call do_one_unbind. (mark_specpdl): Accept 2 arguments. (mark_specpdl): Mark the saved value in a let-binding. * src/emacs.c (main): Call init_threads_once, init_threads, and syms_of_threads. * src/data.c (Ftype_of): Support thread, mutex, and condvar objects. (Fthreadp, Fmutexp, Fcondition_variable_p): New functions. (syms_of_data): DEFSYM and defsubr new symbols and primitives. * src/bytecode.c (struct byte_stack, FETCH, CHECK_RANGE) (BYTE_CODE_QUIT): Add back. (exec_byte_code): Add back byte stack manipulation. * src/alloc.c (cleanup_vector): Handle threads, mutexes, and conditional variables. (mark_stack): Now extern; accept additional argument 'bottom'. (flush_stack_call_func): New function. (garbage_collect_1): Call mark_threads and unmark_threads. Don't mark handlers. * src/.gdbinit (xbytecode): Add back. * test/src/thread-tests.el: New tests. * test/src/data-tests.el (binding-test-manual) (binding-test-setq-default, binding-test-makunbound) (binding-test-defvar-bool, binding-test-defvar-int) (binding-test-set-constant-t, binding-test-set-constant-nil) (binding-test-set-constant-keyword) (binding-test-set-constant-nil): New tests. * doc/lispref/processes.texi (Processes and Threads): New subsection. * doc/lispref/threads.texi: New file * doc/lispref/elisp.texi (Top): Include it. * doc/lispref/objects.texi (Thread Type, Mutex Type) (Condition Variable Type): New subsections. (Type Predicates): Add thread-related predicates. * doc/lispref/objects.texi (Editing Types): * doc/lispref/elisp.texi (Top): Update higher-level menus. * etc/NEWS: Mention concurrency features.
| * | 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>.
| * | Documentation and commentary improvementsEli Zaretskii2016-12-103-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/lisp.h: * src/regex.c: * src/xgselect.c (xg_select): Improve commentary and formatting. * doc/lispref/objects.texi (Thread Type, Mutex Type) (Condition Variable Type): New subsections. (Type Predicates): Add thread-related predicates. * doc/lispref/objects.texi (Editing Types): * doc/lispref/elisp.texi (Top): Update higher-level menus.
| * | *src/sysdep.c: Fix a comment.Eli Zaretskii2016-12-091-1/+1
| | |
| * | Fix compilation error on Fedora 24Eli Zaretskii2016-12-091-6/+0
| | | | | | | | | | | | | | | * src/sysdep.c [HAVE_H_ERRNO]: Remove declaration of h_errno. Reported by Paul Eggert <eggert@cs.ucla.edu>.
| * | Fix compilation warnings due to prototype of thread_selectEli Zaretskii2016-12-094-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | * 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'.
| * | Fix compilation on Debian GNU/LinuxEli Zaretskii2016-12-091-0/+1
| | | | | | | | | | | | | | | * src/thread.h: Include sys/types.h, for ssize_t that regex.h uses. Reported by Robert Marshall <robert.marshall@codethink.co.uk>.
| * | Fix subtle errors with let-binding of localized variablesEli Zaretskii2016-12-091-16/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/eval.c (do_specbind): Don't require a "symbol" that is actually a cons cell, in order to call set-default, as there are no longer such bindings. This makes do_specbind work like the pre-concurrency implementation in specbind for bindings of forwarded symbols. Use specpdl_kind to access the type of the binding. (specpdl_kind): New function.
| * | Fix compilation warningsEli Zaretskii2016-12-081-1/+1
| | | | | | | | | | | | | | | * src/thread.c (Fmake_thread): Call emacs_abort, to avoid compilation warning.
| * | Fix network streams.Eli Zaretskii2016-12-073-20/+27
| | | | | | | | | | | | | | | The original code messed up flags in fd_callback_data[], and also didn't call add_process_read_fd for process-related file descriptors.
| * | Minimize spurious diffs from master.Eli Zaretskii2016-12-073-5/+6
| | |
| * | Fix a typo in bytecode.c.Eli Zaretskii2016-12-061-2/+3
| | |
| * | Fix compilation problems.Eli Zaretskii2016-12-058-48/+10
| | |
| * | Fix merged code in process.c and eval.c.Eli Zaretskii2016-12-052-11/+33
| | |
| * | Merge branch 'concurrency'Eli Zaretskii2016-12-0426-441/+2780
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/systhread.c [WINDOWSNT]: Fix typos in comments.old-branches/concurrencyEli Zaretskii2015-11-031-5/+5
| | | |
| | * | Fix the MS-Windows buildEli Zaretskii2015-11-029-65/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | * | merge from trunkKen Raeburn2015-11-01218-44080/+86889
| | |\ \
| | * | | * src/eval.c (unbind_for_thread_switch): Fix iteration over theBarry O'Reilly2013-10-192-2/+7
| | | | | | | | | | | | | | | | | | | | specpdl stack.
| | * | | change condition-variablep to condition-variable-pTom Tromey2013-10-172-5/+5
| | | | |
| | * | | Fix crashes when unbind_for_thread_switch signals an error.Eli Zaretskii2013-09-014-8/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | Improve MS-Windows implementation of threads.Eli Zaretskii2013-08-314-14/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/systhread.c (sys_cond_init): Set the 'initialized' member to true only if initialization is successful. Initialize wait_count and wait_count_lock. (sys_cond_wait, sys_cond_signal, sys_cond_broadcast): If 'initialized' is false, do nothing. (sys_cond_wait): Fix the implementation to avoid the "missed wakeup" bug: count the waiting threads, and reset the broadcast event once the last thread was released. (sys_cond_signal, sys_cond_broadcast): Use SetEvent instead of PulseEvent. Don't signal the event if no threads are waiting. (sys_cond_destroy): Only close non-NULL handles. (sys_thread_create): Return zero if unsuccessful, 1 if successful. src/systhread.h (w32thread_cond_t): New member 'initialized'. Rename waiters_count and waiters_count_lock to wait_count and wait_count_lock, respectively.
| | * | | Enable thread support in the MS-Windows build.Eli Zaretskii2013-08-303-0/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/systhread.h (w32thread_critsect, w32thread_cond_t, sys_mutex_t) (sys_cond_t, sys_thread_t) [WINDOWSNT]: New data types. src/systhread.c (sys_mutex_init, sys_mutex_lock, sys_mutex_unlock) (sys_mutex_destroy, sys_cond_init, sys_cond_wait) (sys_cond_signal, sys_cond_broadcast, sys_cond_destroy) (sys_thread_self, sys_thread_equal, w32_beginthread_wrapper) (sys_thread_create, sys_thread_yield) [WINDOWSNT]: New functions. configure.ac (THREADS_ENABLED): Enable threads for MinGW, even if pthreads is not available.
| | * | | rename thread-blocker to thread--blockerTom Tromey2013-08-271-1/+1
| | | | |
| | * | | remove binding_symbolTom Tromey2013-08-271-11/+3
| | | | |
| | * | | fix style of threadp, mutexp, and condition-variable-pTom Tromey2013-08-271-6/+3
| | | | |
| | * | | make thread_check_current_buffer return boolTom Tromey2013-08-272-4/+4
| | | | |
| | * | | add a comment before flush_stack_call_funcTom Tromey2013-08-271-0/+11
| | | | |
| | * | | fix whitespace_regexp warningTom Tromey2013-08-261-1/+3
| | | | |
| | * | | Fix MS-Windows build.Eli Zaretskii2013-08-2610-58/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/callproc.c: src/emacs.c: src/filelock.c: src/process.c: src/sysdep.c: src/w32.c: Reshuffle Windows-specific headers to avoid errors with redefinition of fd_set etc. src/process.c: Don't use num_pending_connects when NON_BLOCKING_CONNECT is not defined. src/sysselect.h: Move definitions of FD_* macros and of SELECT_TYPE here from w32.h. src/w32proc.c (sys_select): Adjust the argument types to what thread.h expects. nt/inc/sys/socket.h: Include stdint.h. Include sysselect.h instead of w32.h.
| | * | | use record_unwind_protect_void, avoid warningTom Tromey2013-08-261-4/+3
| | | | |
| | * | | implement --enable-threads and a thread-less modeTom Tromey2013-08-263-23/+112
| | | | |