* doc/misc/tramp.texi (History): Tramp is thread-safe now.
* etc/NEWS: Mention asynchronous visiting of files, and Tramp being
thread-safe.
* lisp/files.el (find-file-read-args): Add optional arument WILDCARDS.
(find-file-with-threads): New defmacro.
(find-file, find-file-other-window, find-file-other-frame)
(find-file-existing, find-alternate-file-other-window)
(find-alternate-file, find-file-literally): New optional argument
THREADS. Adapt docstring if necessary. Wrap the body by
`find-file-with-threads'.
(find-file--read-only, find-file-read-only)
(find-file-read-only-other-window)
(find-file-read-only-other-frame): New optional argument THREADS.
(find-file-noselect): New optional argument THREADS. Adapt
docstring. Create new threads for all files detected through WILDCARDS.
* lisp/net/tramp-compat.el (tramp-compat-main-thread): New defconst.
(tramp-compat-current-thread, tramp-compat-thread-yield)
(tramp-compat-signal): New defsubst.
(tramp-compat-with-mutex): New defmacro.
* lisp/net/tramp.el (tramp-debug-outline-regexp): Add thread regexp.
(tramp-debug-font-lock-keywords): New defconst.
(tramp-debug-outline-level): Adapt to changed
`tramp-debug-outline-regexp'.
(tramp-get-debug-buffer): Use `tramp-debug-font-lock-keywords'.
(tramp-debug-message): Insert also thread name.
(tramp-error): Propagate error to main thread.
(tramp-condition-case-unless-debug): Add declarations.
(tramp-mutex): New defvar.
(tramp-get-mutex): New defun.
(tramp-file-name-handler): Adapt to threads. Lock Tramp mutex.
Set process thread. Propagate signals to main thread.
* lisp/vc/vc-hooks.el (vc-mutex): New autoloaded variable.
(vc-refresh-state): Let it run in own thread. Lock it with `vc-mutex'.