On Mon, 17 Dec 2018 08:22:27 +0900 David Bremner <david@tethera.net> wrote: > Dirk Van Haerenborgh <vhdirk@gmail.com> writes: > > > > For instance, when iterating messages from a thread: Can one still use a > > notmuch_message_t* when the thread is destroyed? > > Are the individual > > messages 'owned' by the thread, or only by the query? Same question for > > 'replies'. > > > > Could someone please shed some light on this? I'd very much appreciate it. > > It's hierarchical (the underlying allocator is talloc). So threads are > owned by the corresponding query, and messages are owned by threads. > > Assuming replies refers to notmuch_message_get_replies, then those are > owned by some thread as well. > > Threads are somewhat lazily constructed, so there's a time where a > message is owned by a query before it is "stolen" by a thread. > > This is all Carl's design, so hopefully he'll correct me if I said > anything outrageously wrong. > > d > Thanks for the answer. When you're saying that threads are "lazily constructed", I assume that it doesn't really matter for the actual API? From that, I'm guessing that the message handover starts and ends within a single API call, before the caller ever has a chance to see the message handle? The importance of lifetimes in Rust only concerns what the API guarantees about the validity of handles/data, so the implementation is free to do whatever as long as those are not impacted. BTW, I've submitted a patch making the guarantee explicitly stated in the docs, see 20181217175748.10814-1-gihu.rhn@porcupinefactory.org . Reviews welcome, a merge is even more welcome. Cheers, rhn _______________________________________________ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch