I have a situation in a mode I'm writing that saves a portion of the output of a long-running asynchronous process to a variable at intermittent intervals. I need to access this data periodically. My question is are variable assignments in elisp atomic (meaning I would always get a complete value, even if it was potentially slightly out of date) or would this be a race condition?

  • 2
    The problem is most likely not the variable assignment. Emacs does stuff like threads and sentinels only when it is waiting for input. It does not have real parallel threads (AFAIK). Most often the real problem is the interprocess communication. The asynchronous process sends data in little junks and the full data package must be reconstructed on receiver side. This can be caused by buffering of the data on the sender side - i.e., on the side of the asynchronous process.
    – Tobias
    Oct 7, 2019 at 8:56

1 Answer 1


Elisp relies on cooperative concurrency, so yes, these are "atomic".
But I suspect, like Tobias, that this answer won't help you very much because you're probably not asking the right question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.