kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject [1/2] kudu git commit: docs: update guidance for binding functions
Date Thu, 03 Jan 2019 17:40:37 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 91f104d3c -> 8864cb284


docs: update guidance for binding functions

Tweaked the docs to call out equivalent STL functions and their
relationship with std::shared_ptr.

A rendered version can be found here:
https://github.com/andrwng/kudu/blob/docs_cbs/docs/contributing.adoc#function-binding-and-callbacks

Change-Id: I326931a096b7184d403aea116248cffcde5c9775
Reviewed-on: http://gerrit.cloudera.org:8080/12146
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/2fa5884a
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/2fa5884a
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/2fa5884a

Branch: refs/heads/master
Commit: 2fa5884a1ba27e518de579811d36b84a25616656
Parents: 91f104d
Author: Andrew Wong <awong@cloudera.com>
Authored: Wed Jan 2 15:45:11 2019 -0800
Committer: Andrew Wong <awong@cloudera.com>
Committed: Thu Jan 3 02:43:38 2019 +0000

----------------------------------------------------------------------
 docs/contributing.adoc | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/2fa5884a/docs/contributing.adoc
----------------------------------------------------------------------
diff --git a/docs/contributing.adoc b/docs/contributing.adoc
index bb2e4f6..68aece1 100644
--- a/docs/contributing.adoc
+++ b/docs/contributing.adoc
@@ -288,16 +288,28 @@ in many places. When interfacing with that code, you can continue to
use `shared
 
 ==== Function Binding and Callbacks
 
-Existing code uses `boost::bind` and `boost::function` for function binding and
-callbacks. For new code, use the `Callback` and `Bind` classes in `gutil` instead.
-While less full-featured (`Bind` doesn't support argument
-place holders, wrapped function pointers, or function objects), they provide
-more options by the way of argument lifecycle management. For example, a
-bound argument whose class extends `RefCounted` will be incremented during `Bind`
-and decremented when the `Callback` goes out of scope.
-
-See the large file comment in _gutil/callback.h_ for more details, and
-_util/callback_bind-test.cc_ for examples.
+Existing code uses `boost::bind` and `boost::function` to capture and manage
+functors. For new code, use `std::bind` and `std::function`, which are
+functionally equivalent.
+
+Alternatively, the `Bind` and `Callback` classes in `gutil` may also be used to
+capture functors. See _gutil/callback.h_ for more details and
+_util/callback_bind-test.cc_ for examples. While less full-featured, they
+provide different options from their counterparts by the way of argument
+lifecycle management. The benefits of each are described below:
+
+.`std::bind` and `std::function`
+[none]
+* natively supports binding `shared_ptr` and `weak_ptr` objects, so a bound
+smartpointer argument will increment its count during `bind`, and decrement it
+when the `function` leaves scope
+* supports argument placeholders, wrapped function pointers, and function objects
+
+.`Bind` and `Callback`
+[none]
+* natively supports binding `RefCounted` objects, so a bound argument whose
+class extends `RefCounted` will increment its count during `Bind` and decrement
+it when the `Callback` goes out of scope
 
 ==== GFlags
 


Mime
View raw message