What are futures?

后端 未结 7 1350
长发绾君心
长发绾君心 2021-02-13 09:37

What are futures? It\'s something to do with lazy evaluation.

7条回答
  •  没有蜡笔的小新
    2021-02-13 10:26

    Futures are also used in certain design patterns, particularly for real time patterns, for example, the ActiveObject pattern, which seperates method invocation from method execution. The future is setup to wait for the completed execution. I tend to see it when you need to move from a multithreaded enviroment to communicate with a single threaded environment. There may be instances where a piece of hardware doesn't have kernel support for threading, and futures are used in this instance. At first glance it not obvious how you would communicate, and surprisingly futures make it fairly simple. I've got a bit of c# code. I'll dig it out and post it.

提交回复
热议问题