[Top][All Lists]

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

Re: with-url

From: Dmitry Gutov
Subject: Re: with-url
Date: Mon, 23 Jan 2017 00:27:30 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Thunderbird/51.0

On 22.01.2017 19:36, Eli Zaretskii wrote:

With the current implementation of concurrency, threads cannot
usefully signal anything: if a thread raises a signal that is not
caught, it simply dies.  And you cannot catch such a signal from
another thread.

The idea is that it would be caught by the caller in the same thread.

So your proposal would mean that the thread which runs the async code
sets some variable, and the application in the main thread then
signals an error based on that variable's value.  is that what you had
in mind?

The model would function somehow like this:

We're in a certain thread. Elisp code calls with-url, the internals make a request, _suspend the current thread_, and when the request is complete, the low-level code updates some variable and resumes the thread. After that, the code in that thread checks the result of the request, and, depending on it, may signal an error.

If the request can't be sent for some reason, so there's no point in suspending the thread, the internals can signal an error right away.

Point is, the errors is signaled in the same thread that made the request. And the execution looks synchronous from the point of view of the high-level code in that thread.

Not sure how/if that would work if the request is made from the main thread. Maybe that kind of code would require a minor rewrite.

reply via email to

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