From 758317387e4383942b16c444978b6658f5f8d2a4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 4 Jan 2018 09:19:04 +1030 Subject: [PATCH] HACKING.md: describe take() in more detail. Signed-off-by: Rusty Russell --- doc/HACKING.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/HACKING.md b/doc/HACKING.md index 4be9d9c50..e2f37e886 100644 --- a/doc/HACKING.md +++ b/doc/HACKING.md @@ -22,8 +22,11 @@ to an array of `struct bitcoin_tx_input`; they are allocated off the all. Tal also supports destructors, which are usually used to remove things from lists, etc. -Some routines use take() to indicate whether they should take ownership -of a pointer. Use this sparingly, as it can be very confusing. +Some routines use take(): take() marks a pointer as to be consumed +(e.g. freed automatically before return) by a called function. It can +safely accept NULL pointers. Functions whose prototype in headers has +the macro TAKES can have the specific argument as a take() call. Use +this sparingly, as it can be very confusing. The more complex daemons use async io (ccan/io): you register callbacks and they happen once I/O is available, then you return what to do next. This