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?
-
2The 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.– TobiasOct 7, 2019 at 8:56
1 Answer
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.