From 9ea8c6c7894b7df87a178f6653017483ce8c3a53 Mon Sep 17 00:00:00 2001 From: yizhiren Date: Mon, 14 Nov 2016 16:19:37 -0800 Subject: [PATCH] correct the description about the thread to run Summary: exchange A and B in this sentence : "Or, maybe x will execute in Thread B, but y and/or z will execute in Thread A". I think x in B and y,z in A is impossible. but x in A and y,z in B is possible, in that example. Closes https://github.com/facebook/folly/pull/514 Reviewed By: yfeldblum Differential Revision: D4176766 Pulled By: Orvid fbshipit-source-id: cf3a47a30d7e43e5291d6b6401198025beba33f8 --- folly/futures/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/futures/README.md b/folly/futures/README.md index a9d7d88e..381070e5 100644 --- a/folly/futures/README.md +++ b/folly/futures/README.md @@ -159,7 +159,7 @@ Although inspired by the C++11 std::future interface, it is not a drop-in replac p.setValue(); -

This is legal and technically threadsafe. However, it is important to realize that you do not know in which thread x, y, and/or z will execute. Maybe they will execute in Thread A when p.setValue() is called. Or, maybe they will execute in Thread B when f.then is called. Or, maybe x will execute in Thread B, but y and/or z will execute in Thread A. There's a race between setValue and then—whichever runs last will execute the callback. The only guarantee is that one of them will run the callback.

+

This is legal and technically threadsafe. However, it is important to realize that you do not know in which thread x, y, and/or z will execute. Maybe they will execute in Thread A when p.setValue() is called. Or, maybe they will execute in Thread B when f.then is called. Or, maybe x will execute in Thread A, but y and/or z will execute in Thread B. There's a race between setValue and then—whichever runs last will execute the callback. The only guarantee is that one of them will run the callback.

Naturally, you will want some control over which thread executes callbacks. We have a few mechanisms to help.

-- 2.34.1