[PATCH] tevent and threads - infrastructure improvements - version #2

Ira Cooper ira at wakeful.net
Tue Sep 15 18:27:12 UTC 2015


Jeremy Allison <jra at samba.org> writes:

> On Tue, Sep 15, 2015 at 09:46:30AM -0700, Jeremy Allison wrote:
>> 
>> Yes, that's a good idea. I'll update the docs to add this and
>> post a new patchset so we have something complete to discuss
>> next week at SDC.
>
> New patchset with expanded comments and expanded docs explaining
> the issue.
>
> From 735e9534ad1da712a9460ad97837d0252c044920 Mon Sep 17 00:00:00 2001
> From: Jeremy Allison <jra at samba.org>
> Date: Wed, 22 Jul 2015 11:52:06 -0700
> Subject: [PATCH 4/4] lib: tevent: docs: Add tutorial on thread usage.
>
> Signed-off-by: Jeremy Allison <jra at samba.org>
> Signed-off-by: Ralph Boehme <slow at samba.org>
> ---
>  lib/tevent/doc/tevent_thread.dox   | 322 +++++++++++++++++++++++++++++++++++++
>  lib/tevent/doc/tevent_tutorial.dox |   2 +
>  2 files changed, 324 insertions(+)
>  create mode 100644 lib/tevent/doc/tevent_thread.dox
>
> diff --git a/lib/tevent/doc/tevent_thread.dox b/lib/tevent/doc/tevent_thread.dox
> new file mode 100644
> index 0000000..8bf181c
> --- /dev/null
> +++ b/lib/tevent/doc/tevent_thread.dox
> @@ -0,0 +1,322 @@
> +/**
> + at page tevent_context Chapter 6: Tevent with threads
> +
> + at section context Tevent with threads
> +
> +In order to use tevent with threads, you must first understand
> +how to use the talloc library in threaded programs. For more
> +information about working with talloc, please visit <a
> +href="http://talloc.samba.org/">talloc website</a> where tutorial and
> +documentation are located.
> +
> +If a tevent context structure is talloced from a NULL, thread-safe talloc
> +context, then it can be safe to use in a threaded program. The function
> +<code>talloc_disable_null_tracking()</code> <b>must</b> be called from the initial
> +program thread before any talloc calls are made to ensure talloc is
> thread-safe.

I don't understand the first sentence of the paragraph above.

And I understand the rest right... Handling talloc and non-main threads
wanting to return data to the main thread will be possible :).

No hacks like what we have in vfs_glusterfs, that can go away?

Thanks,

-Ira



More information about the samba-technical mailing list