Re: [Libguestfs] [nbdkit PATCH 1/2] plugins: Add .thread_model callback

Richard W.M. Jones
2019-05-20T13:36:16Z

On Mon, May 20, 2019 at 07:30:31AM -0500, Eric Blake
wrote:
> +=head2 C<.thread_model>
> +
> + int thread_model (void)
> +
> +This optional callback is called after all the configuration has been
> +passed to the plugin.  It can be used to force a stricter thread model
> +based on configuration, compared to C<THREAD_MODEL>.  See
L</THREADS>
> +below for details.  Attempts to request a looser (more parallel) model
> +are silently ignored.
> +
> +If there is an error, C<.thread_model> should call
C<nbdkit_error>
> +with an error message and return C<-1>.

Two comments:

(1) Do we have an opportunity to change the way the thread model is
specified to allow future expansion.  This might involve returning
something other than the simple int, or could be that we specify
different constants to be returned by this call.

(Actually while making that point I think I've talked myself out of
it.  But probably we should do this in the V3 API, so a note can be
added to that effect at the end of the TODO file.)

(2) Shouldn't it be an error if the thread model returns a more
parallel thread model than the constant?

Anyway patch series generally looks fine to me.

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.