1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-30 00:51:50 -08:00
Commit graph

107223 commits

Author SHA1 Message Date
Tom Tromey
b94de89342 another docstring fixlet 2012-08-19 03:38:30 -06:00
Tom Tromey
266c1c2fd9 minor docstring fixup 2012-08-19 03:36:50 -06:00
Tom Tromey
1fb339bccd add condition-mutex and condition-name 2012-08-19 03:31:57 -06:00
Tom Tromey
9dad5e59e3 ensure name of a thread is a string 2012-08-19 03:26:42 -06:00
Tom Tromey
3cbf5b1d3b ensure name of a mutex is a string 2012-08-19 03:26:09 -06:00
Tom Tromey
977c4aa65f use NILP 2012-08-19 03:25:06 -06:00
Tom Tromey
5651640d57 condition variables
This implements condition variables for elisp.
This needs more tests.
2012-08-19 03:23:03 -06:00
Tom Tromey
ee1464eab1 comment fixes 2012-08-18 20:05:13 -06:00
Tom Tromey
b3c78ffa31 refactor systhread.h
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.
2012-08-18 19:59:47 -06:00
Tom Tromey
f52cfea0dc write docstrings for the thread functions 2012-08-17 07:51:19 -06:00
Tom Tromey
abb9e9d865 declare unbind_for_thread_switch and rebind_for_thread_switch in lisp.h 2012-08-17 07:16:16 -06:00
Tom Tromey
c26c683744 add test case for I/O switching 2012-08-15 13:19:48 -06:00
Tom Tromey
6c0d5ae507 process changes
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.
2012-08-15 13:19:24 -06:00
Tom Tromey
aa14ccd1e2 Prepare process.c for threads by not having global select masks.
The next step is to make it so selects can choose fds by thread.
2012-08-15 13:17:37 -06:00
Tom Tromey
0ccc5d8998 fix a latent bug in process.c
* process.c (wait_reading_process_output): Check Writeok bits,
	not write_mask.
2012-08-15 13:17:05 -06:00
Tom Tromey
dbb33d4e99 This adds thread-blocker, a function to examine what a thread is
blocked on.  I thought this would be another nice debugging addition.
2012-08-15 13:16:33 -06:00
Tom Tromey
8d3566c6a0 This adds names to mutexes. This seemed like a nice debugging
extension.
2012-08-15 13:14:14 -06:00
Tom Tromey
fc196ac952 This adds some tests of the threading code. 2012-08-15 13:11:54 -06:00
Tom Tromey
51100bb8d3 This supplies the mutex implementation for Emacs Lisp.
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.
2012-08-15 13:11:22 -06:00
Tom Tromey
1dcacbc647 This adds most of the thread features visible to emacs lisp.
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.
2012-08-15 13:09:32 -06:00
Tom Tromey
60a9d2a772 This turns thread_state into a pseudovector and updates various bits
of Emacs to cope.
2012-08-15 13:07:04 -06:00
Tom Tromey
e160922c66 This introduces some new functions to handle the specpdl. The basic
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.
2012-08-15 13:04:34 -06:00
Tom Tromey
14b3dc5e4f This introduces the low-level system threading support. It also adds
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.
2012-08-15 13:03:17 -06:00
Tom Tromey
2d525b793f This parameterizes the GC a bit to make it thread-ready.
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.
2012-08-15 13:01:36 -06:00
Tom Tromey
68b3248243 This introduces a thread-state object and moves various C globals
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.
2012-08-15 12:56:38 -06:00
Glenn Morris
5190da91e6 Reword previous NEWS change. 2012-08-15 09:33:12 -07:00
Glenn Morris
2a1e24765b Replace version 24.2 with 24.3 where appropriate (hopefully) 2012-08-15 09:29:11 -07:00
Eli Zaretskii
eb424fe3d6 Fix bug #12196 with incorrect memory allocations for region-cache.
src/region-cache.c (move_cache_gap): Update gap_len using the actual
 growth of the boundaries array.  Do not change cache_len.
2012-08-15 19:21:41 +03:00
Dmitry Antipov
4e6a86c633 Generalize and cleanup font subsystem checks.
* font.h (FONT_DEBUG, font_assert): Remove.
* font.c, fontset.c, w32font.c, xfont.c, xftfont.c: Change
font_assert to eassert.  Use eassert where appropriate.
2012-08-15 18:20:16 +04:00
Chong Yidong
b6928595db Bump version to 24.2.50 2012-08-15 21:26:30 +08:00
Dmitry Antipov
5bf192caba Fix last change to xg_get_font.
* gtkutil.c (xg_get_font): Use pango_units_to_double.
2012-08-15 17:40:00 +08:00
Paul Eggert
8453bb5523 * etags.c (Pascal_functions): Fix parenthesization typo. 2012-08-15 01:57:14 -07:00
Chong Yidong
f2045622a5 Extract better font information from the GTK >= 3.2 font chooser.
* gtkutil.c (xg_get_font): Rename from xg_get_font_name.  When
using the new font chooser, use gtk_font_chooser_get_font_desc to
extract the font descriptor instead of just the font name.  In
that case, return a font spec instead of a string.
(x_last_font_name): Move to this file from xfns.c.

* xfns.c (Fx_select_font): The return value can also be a font
spec.  Move x_last_font_name management to gtkutil.c.

* xfaces.c: Make font weight and style symbols non-static.

* lisp/frame.el (set-frame-font): Accept font objects.
2012-08-15 15:58:34 +08:00
Glenn Morris
e568d279c5 More CPP-DEFINES updates 2012-08-15 00:01:17 -07:00
Stefan Monnier
7f6feb56a7 * src/minibuf.c (read_minibuf): Ignore caller's inhibit-read-only.
Fixes: debbugs:12117
2012-08-15 00:02:14 -04:00
Stefan Monnier
582db66051 * lisp/textmodes/tex-mode.el (tex-insert-quote): ~ is a space.
Fixes: debbugs:12137
2012-08-14 23:46:47 -04:00
Wolfgang Jenkner
456e62c256 * lisp/man.el (Man-overstrike-face, Man-underline-face)
(Man-reverse-face): Remove variables.
(Man-overstrike, Man-underline, Man-reverse): New faces.
(Man-fontify-manpage): Use them instead of the variables.
(Man-cleanup-manpage): Comment change.
(Man-ansi-color-map): New variable.
(Man-fontify-manpage): Use it.
Call ansi-color-apply-on-region to replace ad hoc code.

Fixes: debbugs:12147
2012-08-14 23:37:07 -04:00
Wolfgang Jenkner
2f29c200d8 Implement ANSI SGR parameters 22-27.
* lisp/ansi-color.el (ansi-colors): Doc fix.
(ansi-color-context, ansi-color-context-region): Doc fix.
(ansi-color--find-face): New function.
(ansi-color-apply, ansi-color-apply-on-region): Use it.
Rename the local variable `face' to `codes' since it is now a list of
ansi codes.  Doc fix.
(ansi-color-get-face): Remove.
(ansi-color-parse-sequence): New function, derived from
ansi-color-get-face.
(ansi-color-apply-sequence): Use it.  Rewrite, and support ansi
codes 22-27.

Fixes: debbugs:12146
2012-08-14 23:33:55 -04:00
Stefan Monnier
b4f5e9df77 * lisp/subr.el (read-passwd): Allow use from a minibuffer. 2012-08-14 17:48:52 -04:00
Stefan Monnier
fecbd8ff09 * src/alloc.c (Fgarbage_collect): Use plural form consistently. 2012-08-14 17:38:06 -04:00
Eli Zaretskii
3b61d6c978 Fix compiler warning in keyboard.c. 2012-08-14 22:44:55 +03:00
Eli Zaretskii
baac79fa16 Fix last change in keyboard.c. 2012-08-14 22:11:45 +03:00
Eli Zaretskii
ba025fbd44 Fix and improve GUD Tooltip mode.
lisp/tooltip.el (tooltip-identifier-from-point): Don't treat tokens
 inside comments and strings as identifiers.
 lisp/progmodes/gud.el (gud-tooltip-print-command): Quote the
 expression to evaluate.  This allows to evaluate expressions with
 embedded whitespace.
 (gud-tooltip-tips): Add a blank before the newline in the
 message-box text, for the benefit of message-box emulation on
 MS-Windows.
 lisp/progmodes/gdb-mi.el (gdb-tooltip-print): Don't ignore error
 messages from GDB, pop them up in a tooltip to give feedback to
 user.
 (gdb-tooltip-print-1): Quote the expression to evaluate.  This
 allows to evaluate expressions with embedded whitespace.
 (gdb-inferior-io--init-proc): Don't send "-inferior-tty" command
 if the TTY name is nil or empty (which happens when communicating
 with the inferior via pipes, e.g. on MS-Windows).
 (gdb-internals): If GDB sends a "&\n" empty debugging message,
 don't send that to the GUD buffer.

 doc/emacs/building.texi (Debugger Operation): Correct and improve
 documentation of the GUD Tooltip mode.
2012-08-14 21:48:39 +03:00
Eli Zaretskii
9b8d51650b Fix a problem with disabled mouse movement events.
src/keyboard.c (command_loop_1): Reset ignore_mouse_drag_p flag each
 iteration through the command loop.  Fixes a problem whereby mouse
 movements are ignored until the first mouse click.
2012-08-14 21:25:47 +03:00
Glenn Morris
c548f82180 byte-compile-setq-default fix for bug#12195
* lisp/emacs-lisp/bytecomp.el (byte-compile-setq-default):
Optimize away setq-default with no args, as is done for setq.
2012-08-14 14:23:10 -04:00
Paul Eggert
f5d9e83a70 Use bool for Emacs Lisp booleans.
This is more natural, and on my platform (GCC 4.7.1 x86-64) it
makes Emacs's text size .03% smaller and presumably a bit faster.
* admin/merge-gnulib (GNULIB_MODULES): Add stdbool.  This documents a
new direct dependency; stdbool was already being used indirectly
via other gnulib modules.
* lib-src/make-docfile.c (enum global_type): Sort values roughly in
decreasing alignment, except put functions last.
(compare_globals): Use this new property of enum global_type.
(write_globals): Use bool, not int, for booleans.
* src/lisp.h: Include <stdbool.h>.
(struct Lisp_Boolfwd, defvar_bool):
* src/lread.c (defvar_bool): Use bool, not int, for Lisp booleans.
* src/regex.c [!emacs]: Include <stdbool.h>.
(false, true): Remove; <stdbool.h> does this for us now.
2012-08-14 10:45:25 -07:00
Chong Yidong
4abcdac823 More doc fixes.
* lisp/minibuffer.el (read-file-name): Doc fix.

* character.c (Fcharacterp): Doc fix (Bug#12076).

* data.c (Findirect_variable): Doc fix (Bug#11040).

* editfns.c (Fsave_current_buffer): Doc fix (Bug#11542).

Fixes: debbugs:11542 debbugs:11040 debbugs:12076 debbugs:10881
2012-08-15 01:10:38 +08:00
Chong Yidong
55802e4a3d Doc fixes.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-charset): Doc fix.

* src/chartab.c (Fmap_char_table): Doc fix.

* src/editfns.c (Fformat): Doc fix.

Fixes: debbugs:12059 debbugs:12085 debbugs:12061
2012-08-15 00:28:23 +08:00
Juanma Barranquero
e38b9db247 nt/config.nt: Sync with autogen/config.in.
(_GL_INLINE_HEADER_BEGIN): Update.
2012-08-14 18:15:28 +02:00
Glenn Morris
3c3cda1a73 * lisp/emacs-lisp/bytecomp.el (byte-recompile-file): Doc fix. 2012-08-14 08:58:46 -07:00