diff options
| author | Eli Zaretskii <eliz@gnu.org> | 2016-12-04 19:59:17 +0200 |
|---|---|---|
| committer | Eli Zaretskii <eliz@gnu.org> | 2016-12-04 19:59:17 +0200 |
| commit | de4624c99ea5bbe38ad5aff7b6461cc5c740d0be (patch) | |
| tree | 1b57de9e769cdb695cb2cecf157b50f7dea9cfe5 /lisp | |
| parent | a486fabb41cdbaa5813c2687fd4008945297d71d (diff) | |
| parent | e7bde34e939451d87fb42a36195086bdbe48b5e1 (diff) | |
| download | emacs-de4624c99ea5bbe38ad5aff7b6461cc5c740d0be.tar.gz | |
Merge branch 'concurrency'
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
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/subr.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 5da5bf8388a..1502bed3e4d 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4952,6 +4952,20 @@ as a list.") "-pkg.el")) +;;; Thread support. + +(defmacro with-mutex (mutex &rest body) + "Invoke BODY with MUTEX held, releasing MUTEX when done. +This is the simplest safe way to acquire and release a mutex." + (declare (indent 1) (debug t)) + (let ((sym (make-symbol "mutex"))) + `(let ((,sym ,mutex)) + (mutex-lock ,sym) + (unwind-protect + (progn ,@body) + (mutex-unlock ,sym))))) + + ;;; Misc. (defvar definition-prefixes (make-hash-table :test 'equal) |
