[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: advice needed for multi-threading patch

From: Giuseppe Scrivano
Subject: Re: advice needed for multi-threading patch
Date: Wed, 23 Sep 2009 20:43:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)


Stefan Monnier <address@hidden> writes:

>> Right now when a thread yields it does not release its buffer lock.
> I think it should, unless some of the buffer-local variables are
> let-bound by the thread.

I think actually this is one of the most important decision to take, it
will have a direct influence on buffer-local variables semantic.  In my
opinion, it is better to have few constraints and allow switch as often
as possible.

As Tom said, I was experimenting with gnus and it made me quite
optimistic; in fact these commands are completed successfully:

  (run-in-thread '(gnus) t) ;; with t the thread doesn't attempt to get
                            ;; a lock on the buffer.
  (while (yield)) ;; yield returns nil when there are not other
                  ;; threads -- simulate join.

The nolock argument in run-in-thread is just a hack to get things
working and see quickly some results.  Acquiring always the lock when
accessing the buffer is too restrictive IMHO as too often the buffer is
already locked.

Following your advice to don't allow a switch only when buffer-local
variables are let-bound by the thread, how many times it happens than a
thread let-bound these variables?  Let's say on 100 times, how many
times approximately do you think a switch will not be allowed and the
calling thread blocked?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]