clojure atom实现缓存
reference: stackeroverflow
promise
- You create a
promise
. That promise object can now be passed to any thread. - You continue with calculations. These can be very complicated calculations involving side-effects, downloading data, user input, database access, other promises – whatever you like. The code will look very much like your mainline code in any program.
- When you’re finished, you can
deliver
the results to that promise object. - Any item that tries to
deref
your promise before you’re finished with your calculation will block until you’re done. Once you’re done and you’vedeliver
ed the promise, the promise won’t block any longer.
A
Delay
ensures that some code is either run zero or one time. It's run zero times if the Delay is never derefed.
Delays are also useful for a shared resource between threads.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CountDownLatch 同步计数器 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
future 用法 |
pcall 并发执行多个无参方法
rss中的关键词统计
好消息, 死锁是确定性的.
Executor线程池多次执行方法: 测试atom计数器
deps.edn sample usage