Skip to content
Snippets Groups Projects
Commit 8d922d13 authored by Dorian Weber's avatar Dorian Weber
Browse files

Fixed a subtle bug with regards to the Promise.

parent b6603872
Branches
No related merge requests found
......@@ -565,8 +565,9 @@ impl<T> Promise<T> {
/// Writes the result value and reawakens the caller.
pub fn fulfill(&self, result: T) {
self.result.replace(Some(result));
self.caller.wake_by_ref();
if self.result.replace(Some(result)).is_none() {
self.caller.wake_by_ref();
}
}
/// Extracts the written value and resets the state of the promise.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment