Re:Some thoughts on asynchronous Python API design in a post...
by venantius on Monday November 07, 2016 @12:34PM
(#12892928)
core.async is using locks under the hood - it's just hiding that from you as an implementation detail.
[ Parent
| on HN ]
Re:Some thoughts on asynchronous Python API design in a post...
by retrogradeorbit on Monday November 07, 2016 @08:57PM
(#12896989)
How is it possible then that core.async works on javascript platform, a platform that has no mutexes?
Maybe there is a lock to implement the thread macro (clojure only), but then that uses native threads. How would you propose to handle access to channels between native threads without locks?
As far as I know there is no locking performed in asynchronous code implemented using the go macro. The go macro is a macro that turns your code inside out into a state machine, is it not? Each <! and >! point becomes and entry/exit into that state machine. There are no locks here because the go macro can essentially "rewrite" your source code for you and there is only a single thread of execution through the interconnected state machines.