about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-03-01 02:48:40 +0000
committerEric Wong <e@80x24.org>2017-03-01 02:48:40 +0000
commit10cbedc7702240bdf0e04293f0b3f6e1b89f8f87 (patch)
tree2b4cb5a57af0cefea0796c70ad6925a29bba8bcd
parenta442f2300df950ba410134787168af271c7abfb1 (diff)
downloadraindrops-10cbedc7702240bdf0e04293f0b3f6e1b89f8f87.tar.gz
While #get! is the same as the #initialize method,
the former is public and called explicitly by folks
wishing to reduce allocation overhead.
-rw-r--r--ext/raindrops/linux_tcp_info.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/raindrops/linux_tcp_info.c b/ext/raindrops/linux_tcp_info.c
index eebca94..4693e47 100644
--- a/ext/raindrops/linux_tcp_info.c
+++ b/ext/raindrops/linux_tcp_info.c
@@ -131,6 +131,19 @@ void Init_raindrops_linux_tcp_info(void)
         cTCP_Info = rb_define_class_under(cRaindrops, "TCP_Info", rb_cObject);
         rb_define_alloc_func(cTCP_Info, alloc);
         rb_define_private_method(cTCP_Info, "initialize", init, 1);
+
+        /*
+         * Document-method: Raindrops::TCP_Info#get!
+         *
+         * call-seq:
+         *
+         *        info = Raindrops::TCP_Info.new(tcp_socket)
+         *        info.get!(tcp_socket)
+         *
+         * Update an existing TCP_Info objects with the latest stats
+         * from the given socket.  This even allows sharing TCP_Info
+         * objects between different sockets to avoid garbage.
+         */
         rb_define_method(cTCP_Info, "get!", init, 1);
 
 #define TCPI_DEFINE_METHOD(x) \