Fix SharedPromise::isFulfilled doesn't get back correct value when it's running in...
authorBi Xue <bixue@fb.com>
Mon, 26 Jun 2017 19:19:40 +0000 (12:19 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 26 Jun 2017 19:24:35 +0000 (12:24 -0700)
commit6cf4cd30fc40660978b14c118db081da529b7a88
tree0b2598345c95a2a21ba4df061bd112af7320e0f4
parentc5184205d39da8e99b3f61b53b38e873f4d06c7c
Fix SharedPromise::isFulfilled doesn't get back correct value when it's running in a different thread of SharedPromise::setValue

Summary: The implementation of `SharedPromise::isFulfilled` return `hasValue_` directly without taking a lock. `isFulfilled` can be accessed concurrently, but `hasValue_` is not synchronized. Adding a lock fix the issue.

Reviewed By: yfeldblum

Differential Revision: D5319030

fbshipit-source-id: a94b12ed277aa64254680ae84cb18946226cceea
folly/futures/SharedPromise-inl.h