After previous changes, it is now safe to use the parallel thread model in this plugin. The locking in pool.c protects a single curl handle from being used from multiple threads.
An advantage of this is we can now combine the curl plugin with filters such as readahead and scan. --- plugins/curl/curl.c | 2 +- plugins/curl/scripts.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c index 105de29c6..c1d9df746 100644 --- a/plugins/curl/curl.c +++ b/plugins/curl/curl.c @@ -457,7 +457,7 @@ curl_close (void *handle) free (h); } -#define THREAD_MODEL NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS +#define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL /* Calls get_handle() ... put_handle() to get a handle for the length * of the current scope. diff --git a/plugins/curl/scripts.c b/plugins/curl/scripts.c index 9b674fc83..786ff7503 100644 --- a/plugins/curl/scripts.c +++ b/plugins/curl/scripts.c @@ -86,8 +86,8 @@ static void error_from_tmpfile (const char *what, const char *tmpfile); /* This is called from any thread just before we make a curl request. * - * Because the thread model is NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS - * we can be assured of exclusive access to handle here. + * Because the curl handle must be obtained through get_handle() we + * can be assured of exclusive access here. */ int do_scripts (struct curl_handle *ch) -- 2.39.0 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs