[Top][All Lists]

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

Re: Asynchronous insertion / saving of buffers

From: Stefan Monnier
Subject: Re: Asynchronous insertion / saving of buffers
Date: Sat, 21 Apr 2012 10:17:28 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)

>> With threads you could "just" do something like
>> (run-thread (lambda ()
>> (insert-file-contents ...)
>> ...))
>> so there'd be no need to provide new asynchronous versions of things
>> like insert-file-contents.
> But you still need a mean to inform the caller, that the parallel action
> has been finished. And you need a mean to lock the buffer, while
> insert-file-contents modifies it.

Of course, but none of that is specific to insert-file-contents.
It's just part of the functionality that is generally needed for concurrency.

> I haven't read the doc in the concurrency branch, maybe this would
> answer my questions.

I don't think we'd have any locking, instead you'd have to be careful
not to touch the buffer until insert-file-contents is over.
But you could add a `busy' buffer-local variable and use it as a lock if
you feel like it.

Also to inform other code that insert-file-contents is done, you can
simply use a `done' variable which you set to t when it's done, so the
other code can check when it's over.  But a more likely way to work is
to put the "things to do when the insert-file-contents is done" in the
second "..." of my sample code.


reply via email to

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