]>
git.eshelyaron.com Git - emacs.git/log
Giuseppe Scrivano [Mon, 29 Mar 2010 09:52:46 +0000 (11:52 +0200)]
Define the `mutexp' function.
Giuseppe Scrivano [Mon, 29 Mar 2010 09:31:08 +0000 (11:31 +0200)]
Add support for non-recursive mutexes.
make-mutex accepts a new parameter, if the value is non nil then the
mutex is recursive; by default a non-recursive mutex is created.
Giuseppe Scrivano [Thu, 11 Mar 2010 12:10:11 +0000 (13:10 +0100)]
Fix problems caused by the last rebase.
Giuseppe Scrivano [Sat, 13 Feb 2010 00:09:42 +0000 (01:09 +0100)]
Handle exclusive access to the minibuffer using a mutex, remove inhibit-yield
Giuseppe Scrivano [Fri, 12 Feb 2010 23:42:25 +0000 (00:42 +0100)]
Mutex object initial implementation.
Giuseppe Scrivano [Fri, 22 Jan 2010 01:39:51 +0000 (02:39 +0100)]
Revert "Support more complex code blocks as argument to `run-in-thread"
This reverts commit
a54548174153cb02b366fe6164cf3aa30597759c .
Giuseppe Scrivano [Thu, 14 Jan 2010 16:13:01 +0000 (17:13 +0100)]
Remove blocal_getrealvalue
Giuseppe Scrivano [Thu, 14 Jan 2010 11:19:45 +0000 (12:19 +0100)]
If a no-let-bound buffer-local symbol's value is modified, propagate it.
Giuseppe Scrivano [Thu, 14 Jan 2010 09:32:44 +0000 (10:32 +0100)]
the thread_yield return value considers blocked threads too
Giuseppe Scrivano [Thu, 14 Jan 2010 09:31:28 +0000 (10:31 +0100)]
xg_select uses thread_select
Giuseppe Scrivano [Wed, 13 Jan 2010 21:38:06 +0000 (22:38 +0100)]
Fix gnus startup in a separate thread.
Giuseppe Scrivano [Wed, 13 Jan 2010 17:01:21 +0000 (18:01 +0100)]
local_var_alist_ is shared by threads.
- buffer local values per-thread cleanup.
- any binding-testsuite.el test is completed successfully.
Giuseppe Scrivano [Tue, 12 Jan 2010 12:23:27 +0000 (13:23 +0100)]
Cleanup
Giuseppe Scrivano [Mon, 11 Jan 2010 16:57:26 +0000 (17:57 +0100)]
Fix some binding-testsuite.el test cases when threads are used.
This one still fails:
(defvar binding-test-some-local 'some)
(defvar binding-test-buffer-A (get-buffer-create "A"))
(with-current-buffer binding-test-buffer-A
(set (make-variable-buffer-local 'binding-test-some-local) 'local))
(run-in-thread '(with-current-buffer binding-test-buffer-A
(message "local: %s" binding-test-some-local)))
(while (yield))
Giuseppe Scrivano [Mon, 11 Jan 2010 09:20:02 +0000 (10:20 +0100)]
Use get_current_thread to retrieve the current thread object.
Giuseppe Scrivano [Mon, 11 Jan 2010 00:29:19 +0000 (01:29 +0100)]
Fix a bug introduced by recent changes
Giuseppe Scrivano [Sun, 3 Jan 2010 22:40:23 +0000 (23:40 +0100)]
Use the `realvalue' when the default binding is used.
Giuseppe Scrivano [Sun, 3 Jan 2010 13:58:50 +0000 (14:58 +0100)]
Unbind thread-bound variables when the thread is terminated.
Giuseppe Scrivano [Sun, 3 Jan 2010 04:01:10 +0000 (05:01 +0100)]
Propagate buffer-local-variables changes to other threads.
It is done in a quite expensive way, O(n^2) in the threads number.
Giuseppe Scrivano [Sat, 2 Jan 2010 18:09:30 +0000 (19:09 +0100)]
Buffer local variables per-thread almost work now
A know problem is backward propagation. A global buffer local
variable modified in a thread is not seen by other threads.
Giuseppe Scrivano [Fri, 1 Jan 2010 13:08:47 +0000 (14:08 +0100)]
Use the global value as initial realvalue.
Giuseppe Scrivano [Fri, 1 Jan 2010 01:10:06 +0000 (02:10 +0100)]
Handle default value
Giuseppe Scrivano [Thu, 31 Dec 2009 18:32:35 +0000 (19:32 +0100)]
Fix gc segfault.
Giuseppe Scrivano [Thu, 31 Dec 2009 18:24:00 +0000 (19:24 +0100)]
Use the buffer local value for symval forwarding
Giuseppe Scrivano [Thu, 31 Dec 2009 13:42:56 +0000 (14:42 +0100)]
Avoid a double symval forwarding
Giuseppe Scrivano [Thu, 31 Dec 2009 13:13:35 +0000 (14:13 +0100)]
Fix per-thread buffer-local variables
Giuseppe Scrivano [Thu, 31 Dec 2009 12:29:56 +0000 (13:29 +0100)]
Fix make bootstrap
Giuseppe Scrivano [Thu, 31 Dec 2009 00:42:56 +0000 (01:42 +0100)]
now realvalue is a Lisp_ThreadLocal
Giuseppe Scrivano [Mon, 28 Dec 2009 22:25:57 +0000 (23:25 +0100)]
Initialize realvalue to sym->value.
Giuseppe Scrivano [Sun, 27 Dec 2009 21:03:19 +0000 (22:03 +0100)]
Remove control, l->thread_data can't be nil at this point.
Giuseppe Scrivano [Sun, 27 Dec 2009 18:56:52 +0000 (19:56 +0100)]
blocal_get_thread_data is not used before blocal_set_thread_data.
Giuseppe Scrivano [Sat, 26 Dec 2009 18:36:46 +0000 (19:36 +0100)]
Move realvalue to thread_data.
Giuseppe Scrivano [Sat, 26 Dec 2009 16:55:04 +0000 (17:55 +0100)]
Rename struct Lisp_Buffer_Local_Value `cdrs' member to `thread_data'.
Giuseppe Scrivano [Fri, 25 Dec 2009 00:06:41 +0000 (01:06 +0100)]
Initial per-thread buffer local variables support.
Now this example works well:
(progn
(make-variable-buffer-local 'va)
(defun tha ()
(dolist (va '("AA" "AB" "AC" "AD" "AE"))
(message "thread a: %s" va)
(yield)
(message "thread a: %s" va)))
(defun thb ()
(dolist (va '("BF" "BG" "BH" "BI" "BL"))
(message "thread b: %s" va)
(yield)
(message "thread b: %s" va)))
(with-current-buffer (get-buffer-create "a")
(run-in-thread '(tha)))
(thb))
Tom Tromey [Sun, 29 Nov 2009 20:12:13 +0000 (21:12 +0100)]
Change Lisp_Buffer_Local_Value representation.
This doesn't change semantics but prepares the way for per-thread
buffer-local bindings.
Tom Tromey [Sun, 15 Nov 2009 04:44:54 +0000 (05:44 +0100)]
Define and use SET_PER_BUFFER_VALUE_RAW
Giuseppe Scrivano [Wed, 11 Nov 2009 11:08:49 +0000 (12:08 +0100)]
Fix some elisp routines.
Giuseppe Scrivano [Wed, 11 Nov 2009 10:00:09 +0000 (11:00 +0100)]
Set the buffer after the lock is acquired.
Giuseppe Scrivano [Wed, 11 Nov 2009 09:55:48 +0000 (10:55 +0100)]
Remove desired_buffer from the thread_state struct.
Giuseppe Scrivano [Wed, 11 Nov 2009 09:36:26 +0000 (10:36 +0100)]
Rename buffer_cond to thread_cond.
Giuseppe Scrivano [Mon, 9 Nov 2009 19:35:43 +0000 (20:35 +0100)]
Remove the buffer-locking mechanism.
Giuseppe Scrivano [Thu, 8 Oct 2009 20:37:30 +0000 (22:37 +0200)]
Handle the thread_notify_kill_buffer return code.
Giuseppe Scrivano [Thu, 8 Oct 2009 20:30:44 +0000 (22:30 +0200)]
Notify threads when a buffer is killed.
Tom Tromey [Tue, 6 Oct 2009 01:08:08 +0000 (03:08 +0200)]
Initialize threads properly.
Revert a few BUF_ changes to use direct field access.
Giuseppe Scrivano [Mon, 5 Oct 2009 18:28:54 +0000 (20:28 +0200)]
Inhibit yield during a redisplay
Giuseppe Scrivano [Mon, 5 Oct 2009 18:22:58 +0000 (20:22 +0200)]
`unbind_to' will restore the previous inhibit_yield status.
Tom Tromey [Fri, 2 Oct 2009 04:47:30 +0000 (06:47 +0200)]
Use ALLOCATE_PSEUDOVECTOR.
Restore an initialization in search.c.
(Still doesn't build.)
Giuseppe Scrivano [Thu, 1 Oct 2009 13:22:27 +0000 (15:22 +0200)]
Mark `last_thing_searched' and `saved_last_thing_searched' before free unused memory.
Giuseppe Scrivano [Wed, 30 Sep 2009 21:06:06 +0000 (23:06 +0200)]
Allow to yield when buffer local variables are let-bound by a thread.
Tom Tromey [Tue, 29 Sep 2009 04:21:31 +0000 (06:21 +0200)]
Make regular expression match data per-thread.
Tom Tromey [Mon, 28 Sep 2009 15:45:02 +0000 (17:45 +0200)]
minor updates to buffer-objfwd patch
Tom Tromey [Mon, 28 Sep 2009 03:08:56 +0000 (05:08 +0200)]
Make buffer-objfwd variables work per-thread.
See hack-buffer-objfwd.el to see how this was done.
Giuseppe Scrivano [Thu, 24 Sep 2009 21:51:33 +0000 (23:51 +0200)]
Set the current_buffer properly.
Giuseppe Scrivano [Thu, 24 Sep 2009 14:50:30 +0000 (16:50 +0200)]
Detach the thread when it is sleeping on `select'
Giuseppe Scrivano [Thu, 24 Sep 2009 10:36:48 +0000 (12:36 +0200)]
Unlock the buffer on yields when buffer local variables are not bound by the thread.
Giuseppe Scrivano [Wed, 23 Sep 2009 13:25:49 +0000 (15:25 +0200)]
Yield to another thread if the subprocess has no data available.
Giuseppe Scrivano [Tue, 22 Sep 2009 13:13:41 +0000 (15:13 +0200)]
Move with-no-threads inside the let body block.
Giuseppe Scrivano [Mon, 21 Sep 2009 19:34:53 +0000 (21:34 +0200)]
Define the `with-no-threads' macro and use it in the read-* functions.
Giuseppe Scrivano [Mon, 21 Sep 2009 12:51:27 +0000 (14:51 +0200)]
Fix a problem with the garbage collector, storing the stack top every
time the running thread is blocked.
Giuseppe Scrivano [Sat, 19 Sep 2009 22:28:05 +0000 (00:28 +0200)]
Rewrite the condition to wake-up the thread that locked the buffer. Also don't try to schedule a new thread when this is not possible.
Tom Tromey [Sat, 19 Sep 2009 22:02:05 +0000 (00:02 +0200)]
Define with-new-thread macro.
Tom Tromey [Sat, 19 Sep 2009 21:59:51 +0000 (23:59 +0200)]
Call error if thread creation failed.
Giuseppe Scrivano [Sat, 19 Sep 2009 21:09:17 +0000 (23:09 +0200)]
Raise an error when the thread cannot be created correctly.
Giuseppe Scrivano [Sat, 19 Sep 2009 18:29:38 +0000 (20:29 +0200)]
Implementation of a custom threads scheduler. Try to wake-up the thread with a lock on the desired buffer, if it can't be done then use round-robin.
Giuseppe Scrivano [Sat, 19 Sep 2009 14:09:32 +0000 (16:09 +0200)]
Move all locking logic into thread.c.
Giuseppe Scrivano [Sat, 19 Sep 2009 11:49:04 +0000 (13:49 +0200)]
When there are other active threads, yield returns t.
Giuseppe Scrivano [Fri, 18 Sep 2009 20:16:30 +0000 (22:16 +0200)]
run-in-thread accepts a new optional argument: nolock.
When it is no-nil the thread does not try to get a lock on the current
buffer before work on it.
With this change, the following example works quite smoothly; while
loading imap folders, gnus yields to another thread:
(load-library "gnus")
;; Redefine to use yield
(defun imap-send-command-wait (command &optional buffer)
(imap-wait-for-tag (prog1 (imap-send-command command buffer) (yield)) buffer))
(progn
(run-in-thread '(gnus) t)
(dotimes (i 20)
;; yield is called automatically during a buffer-switch
(message (format "I got here %i" i))))
Giuseppe Scrivano [Fri, 18 Sep 2009 15:23:42 +0000 (17:23 +0200)]
Protect from yield while waiting for keyboard input.
Giuseppe Scrivano [Fri, 18 Sep 2009 14:27:28 +0000 (16:27 +0200)]
Giuseppe Scrivano [Fri, 18 Sep 2009 10:51:14 +0000 (12:51 +0200)]
Block yield if garbage collecting can cause an abort.
Giuseppe Scrivano [Fri, 18 Sep 2009 10:43:01 +0000 (12:43 +0200)]
A new thread maintain the parent's buffer when the thread starts not after it entered in `global_lock'.
Giuseppe Scrivano [Fri, 18 Sep 2009 10:41:22 +0000 (12:41 +0200)]
Block yield when input is blocked.
Giuseppe Scrivano [Fri, 18 Sep 2009 08:40:21 +0000 (10:40 +0200)]
When Finhibit_yield is not-nil, allow access to any buffer from the
current thread. It is needed to avoid deadlocks or undesidered
threads switch.
This mechanism is implemented storing the previous buffer's owner and
restore it when the current thread releases the buffer.
Giuseppe Scrivano [Thu, 17 Sep 2009 22:25:52 +0000 (00:25 +0200)]
Giuseppe Scrivano [Thu, 17 Sep 2009 21:50:10 +0000 (23:50 +0200)]
Use `waitpid' to check if a process is still alive. The previous mechanism caused threads to hang.
Giuseppe Scrivano [Thu, 17 Sep 2009 21:48:34 +0000 (23:48 +0200)]
Allow access to the minibuffer only to a thread at time.
Giuseppe Scrivano [Thu, 17 Sep 2009 21:39:25 +0000 (23:39 +0200)]
Honor the function return type.
Giuseppe Scrivano [Thu, 17 Sep 2009 21:38:24 +0000 (23:38 +0200)]
Avoid the access to NULL memory while gc marks.
Giuseppe Scrivano [Thu, 17 Sep 2009 19:28:05 +0000 (21:28 +0200)]
Remove assertion that does not seem valid anymore.
Giuseppe Scrivano [Thu, 17 Sep 2009 16:02:09 +0000 (18:02 +0200)]
Now it is possible to disable threading using "inhibit-yield".
It should be used in a similar way:
(defmacro with-no-threading (&rest body)
`(unwind-protect (inhibit-yield nil)
(progn (inhibit-yield t)
,@body)))
Giuseppe Scrivano [Thu, 17 Sep 2009 09:49:56 +0000 (11:49 +0200)]
Reflect last changes in the GDB script.
Giuseppe Scrivano [Thu, 17 Sep 2009 09:40:18 +0000 (11:40 +0200)]
Signals can be captured by any thread.
Giuseppe Scrivano [Wed, 16 Sep 2009 23:04:50 +0000 (01:04 +0200)]
Initialize a new buffer's owner to nil.
Giuseppe Scrivano [Wed, 16 Sep 2009 14:14:32 +0000 (16:14 +0200)]
Support more complex code blocks as argument to `run-in-thread
It introduces this change:
(defun tha ()
...)
(run-in-thread 'tha)
becomes:
(run-in-thread '(tha))
Giuseppe Scrivano [Wed, 16 Sep 2009 13:07:59 +0000 (15:07 +0200)]
Free the thread specdl. Bug introduced with
c466c557f39fc71c10b16e93b484a83187780228 .
Giuseppe Scrivano [Wed, 16 Sep 2009 12:52:07 +0000 (14:52 +0200)]
Revert to the previous code.
Giuseppe Scrivano [Wed, 16 Sep 2009 11:23:35 +0000 (13:23 +0200)]
Check for `other_threads_p ()' in the inner loop too because this condition can change since the initial check.
Giuseppe Scrivano [Wed, 16 Sep 2009 09:49:06 +0000 (11:49 +0200)]
Solve some problems with memory cleanup.
Remove explicit calls to `xfree' but leave `lisp_malloc'ed memory to
the garbage collector.
Check for `pthread_create' errors and restore the previous situation
in case something went wrong.
Giuseppe Scrivano [Tue, 15 Sep 2009 22:21:10 +0000 (00:21 +0200)]
Fix a segfault when m_current_buffer is NULL
Giuseppe Scrivano [Tue, 15 Sep 2009 15:09:53 +0000 (17:09 +0200)]
Initialize stack_top when a new thread is created.
Tom Tromey [Mon, 14 Sep 2009 22:30:43 +0000 (00:30 +0200)]
Release the current buffer when a thread exits.
Tom Tromey [Sun, 13 Sep 2009 19:18:03 +0000 (21:18 +0200)]
Fix boundp and a bug in store_symval_forwarding.
Tom Tromey [Fri, 11 Sep 2009 18:05:55 +0000 (20:05 +0200)]
First working draft of thread-local binding.
At least 2 of the 9 kinds of variable bindings should work ok --
defvaralias variables and ordinary variables.
All other kinds will exhibit weird behavior.
A simple program that works:
(defvar zz t)
(defvar buffer-a (get-buffer-create "zardoz"))
(defun tha ()
(dolist (v '("A" "B" "C" "D"))
(message "thread a: %s" v)
(yield))
(setq zz nil))
(defun thb ()
(dolist (v '("E" "F" "G" "H" "I"))
(message "thread b: %s" v)
(yield)
))
(with-current-buffer buffer-a
(run-in-thread 'tha))
(thb)
(while zz
(yield))
Tom Tromey [Fri, 11 Sep 2009 17:46:07 +0000 (19:46 +0200)]
Fix another oversight in thread.c.
Tom Tromey [Fri, 11 Sep 2009 17:17:46 +0000 (19:17 +0200)]
Fix two bad bugs in thread.c.
Tom Tromey [Wed, 9 Sep 2009 21:50:06 +0000 (23:50 +0200)]
Initial code for buffer locking.
Add some buffer locking; does not yet actually work.
Make current_buffer per-thread.
Turn thread_state into a vectorlike.
Arrange to populate initial specpdl; put condition-case around
thread body.
Tom Tromey [Wed, 9 Sep 2009 21:38:04 +0000 (23:38 +0200)]
Introduce threads.
Add a new thread.c file.
Move selected globals to a thread-specific structure.
Add elisp functions run-in-thread and yield.
Update GC to work with threads.
Tom Tromey [Wed, 9 Sep 2009 20:24:14 +0000 (22:24 +0200)]
Introduce thread-local object.
Add minimal support for it.
Tom Tromey [Wed, 9 Sep 2009 19:45:59 +0000 (21:45 +0200)]
Rewrite globals to allow indirection in C.
The bulk of the patch was done by running rewrite-globals.el.
Then a couple minor fixes were applied by hand.
Tom Tromey [Wed, 9 Sep 2009 19:20:10 +0000 (21:20 +0200)]
Add find_variable_location and create globals.h.
This is just a support patch to ensure that the next patch can
build properly.