Once the message has been sent, the sender can store a reference to the Future object and check periodically for completion, or it can block and wait if needed by calling the get method.
消息被发送之后,发送者可以保存对Future对象的一个引用并定期检查是否完成,或者,它也可以通过调用get方法来阻塞和等待。
allows your thread to block - by calling f.get() - to ensure the network calls succeed, or go away by ignoring f altogether.
可以阻塞线程,再调用f.get()可以让网络调用继续进行或是忽略掉f。
If you need to block the calling thread for a specific time, then use the pthread_cond_timewait to block the thread.
如果您需要在指定的一段时间内阻塞发出调用的线程,那么请使用pthread_cond _ timewait来阻塞它。
应用推荐