Commit 3947bb6e authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

Fix documentation in callback.h

Comments in callback.h were confusing because sample code was
incorrect. Updated sample code to make it consistent with the
documented behavior.

Change-Id: Id42a9465c49b65937d7b34bf8c0b3664085a628f
Reviewed-on: https://chromium-review.googlesource.com/1019870Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552205}
parent 478e85a9
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
// }, 1); // }, 1);
// // Run() only needs the remaining unbound argument |y|. // // Run() only needs the remaining unbound argument |y|.
// printf("1 + 2 = %d\n", std::move(cb).Run(2)); // Prints 3 // printf("1 + 2 = %d\n", std::move(cb).Run(2)); // Prints 3
// printf("cb is null? %s\n", cb ? "true" : "false"); // Prints true // printf("cb is null? %s\n",
// cb.is_null() ? "true" : "false"); // Prints true
// std::move(cb).Run(2); // Crashes since |cb| has already run. // std::move(cb).Run(2); // Crashes since |cb| has already run.
// //
// Callbacks also support cancellation. A common use is binding the receiver // Callbacks also support cancellation. A common use is binding the receiver
......
Markdown is supported
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