search for: _thread_model

Displaying 20 results from an estimated 45 matches for "_thread_model".

Did you mean: thread_model
2018 Jan 16
1
Re: [PATCH nbdkit 1/3] plugins: Move locking to a new file.
...| 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ > src/plugins.c | 77 +++++------------------------------- > 5 files changed, 142 insertions(+), 79 deletions(-) > > +++ b/src/locks.c > +void > +lock_connection (void) > +{ > + int thread_model = plugin_thread_model (); > + > + if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS) { > +++ b/src/plugins.c > +int > +plugin_thread_model (void) > +{ > + assert (dl); > + > + return plugin._thread_model; > +} The new code asserts dl prior to locking the connection; &g...
2018 Jan 17
0
[PATCH 1/9] plugins: Move locking to a new file.
...11a810..74bb8e4 100644 --- a/src/connections.c +++ b/src/connections.c @@ -211,7 +211,7 @@ _handle_single_connection (int sockin, int sockout) int nworkers = threads ? threads : DEFAULT_PARALLEL_REQUESTS; pthread_t *workers = NULL; - if (!plugin_is_parallel() || nworkers == 1) + if (plugin_thread_model () < NBDKIT_THREAD_MODEL_PARALLEL || nworkers == 1) nworkers = 0; conn = new_connection (sockin, sockout, nworkers); if (!conn) @@ -287,9 +287,9 @@ handle_single_connection (int sockin, int sockout) { int r; - plugin_lock_connection (); + lock_connection (); r = _handle_sin...
2018 Jan 16
0
[PATCH nbdkit 1/3] plugins: Move locking to a new file.
...11a810..74bb8e4 100644 --- a/src/connections.c +++ b/src/connections.c @@ -211,7 +211,7 @@ _handle_single_connection (int sockin, int sockout) int nworkers = threads ? threads : DEFAULT_PARALLEL_REQUESTS; pthread_t *workers = NULL; - if (!plugin_is_parallel() || nworkers == 1) + if (plugin_thread_model () < NBDKIT_THREAD_MODEL_PARALLEL || nworkers == 1) nworkers = 0; conn = new_connection (sockin, sockout, nworkers); if (!conn) @@ -287,9 +287,9 @@ handle_single_connection (int sockin, int sockout) { int r; - plugin_lock_connection (); + lock_connection (); r = _handle_sin...
2017 Nov 14
0
[PATCH 2/3] Avoid race conditions when nbdkit exits.
...d (); @@ -163,6 +169,8 @@ plugin_cleanup (void) dl = NULL; free (filename); filename = NULL; + + pthread_rwlock_unlock (&unload_prevention_lock); } } @@ -299,8 +307,6 @@ plugin_config_complete (void) void plugin_lock_connection (void) { - assert (dl); - if (plugin._thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS) { debug ("%s: acquire connection lock", filename); pthread_mutex_lock (&connection_lock); @@ -310,8 +316,6 @@ plugin_lock_connection (void) void plugin_unlock_connection (void) { - assert (dl); - if (plugin._thread_mode...
2018 Jan 16
6
[PATCH nbdkit 0/3] Refactor plugin_* functions into a backend struct.
Somewhat invasive but mostly mechanical change to how plugins are called. This patch is in preparation for adding a second backend subtype for filters. Rich.
2018 Jan 16
4
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend
v1 -> v2: - Fixed everything mentioned in the review. Rich.
2019 Aug 16
0
[nbdkit PATCH 2/2] rust: Add support for dynamic .thread_model
...lugin.pod b/plugins/rust/nbdkit-rust-plugin.pod index 930829cc..61c2e0ba 100644 --- a/plugins/rust/nbdkit-rust-plugin.pod +++ b/plugins/rust/nbdkit-rust-plugin.pod @@ -37,14 +37,19 @@ compatible with the C struct used by C plugins. use nbdkit::ThreadModel::*; #[no_mangle] + extern fn myplugin_thread_model () -> ThreadModel { + Serialize_AllRequests + } + + //... more functions + pub extern fn plugin_init () -> *const Plugin { // Plugin name. let name = "myplugin\0" as *const str as *const [c_char] as *const c_char; - // Create a mutable plugin, setting the...
2019 Aug 16
1
Re: [nbdkit PATCH 2/2] rust: Add support for dynamic .thread_model
...gin.pod > index 930829cc..61c2e0ba 100644 > --- a/plugins/rust/nbdkit-rust-plugin.pod > +++ b/plugins/rust/nbdkit-rust-plugin.pod > @@ -37,14 +37,19 @@ compatible with the C struct used by C plugins. > use nbdkit::ThreadModel::*; > > #[no_mangle] > + extern fn myplugin_thread_model () -> ThreadModel { > + Serialize_AllRequests > + } > + > + //... more functions > + > pub extern fn plugin_init () -> *const Plugin { > // Plugin name. > let name = "myplugin\0" > as *const str as *const [c_char] as *const c_char;...
2019 Aug 16
7
[nbdkit PATCH 0/2] rust: Implement some missing v2 callbacks
Similar to what I just did for OCaml (this IS an API break, requiring recompilation of any existing Rust plugin), and done because I want to add fast_zero support to both languages as part of my upcoming fast zero series. Figuring out how to get extents working was hard enough that I punted that, still. Eric Blake (2): rust: Implement can_cache rust: Add support for dynamic .thread_model
2017 Nov 14
7
[PATCH 0/3] Alternate way to avoid race conditions when nbdkit exits.
This fixes the race conditions for me, using the test described here: https://www.redhat.com/archives/libguestfs/2017-September/msg00226.html Rich.
2017 Feb 20
1
Re: Fwd: nbdkit async
The concern is a client is blocked while processing a request. The nbdkit server design requires a thread per request being processed regardless of the number of connections or clients. We want to run 1000's of requests in parallel without needing a thread at nbdkit layer per request in flight. Our plugin layer is built around boost asio and a few threads in a worker pool running an io
2019 May 20
0
[nbdkit PATCH 1/2] plugins: Add .thread_model callback
...;THREAD_MODEL>, the C<.thread_model> if present, and any restrictions +requested by filters. The possible settings for C<THREAD_MODEL> are defined below. @@ -935,7 +959,8 @@ parallel. However only one request will happen per handle at a time =item C<#define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL> Multiple handles can be open and multiple data requests can happen in -parallel (even on the same handle). +parallel (even on the same handle). The server may reorder replies, +answering a later request before an earlier one. All the libraries you use must be thread-safe and reent...
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...src/connections.c b/src/connections.c index 74bb8e4..921a5b2 100644 --- a/src/connections.c +++ b/src/connections.c @@ -211,16 +211,17 @@ _handle_single_connection (int sockin, int sockout) int nworkers = threads ? threads : DEFAULT_PARALLEL_REQUESTS; pthread_t *workers = NULL; - if (plugin_thread_model () < NBDKIT_THREAD_MODEL_PARALLEL || nworkers == 1) + if (backend->thread_model (backend) < NBDKIT_THREAD_MODEL_PARALLEL || + nworkers == 1) nworkers = 0; conn = new_connection (sockin, sockout, nworkers); if (!conn) goto done; - if (plugin_open (conn, readonly) ==...
2019 May 17
0
[nbdkit PATCH 3/3] filters: Use only .thread_model, not THREAD_MODEL
...s(+), 68 deletions(-) diff --git a/docs/nbdkit-filter.pod b/docs/nbdkit-filter.pod index 4033789..86894f1 100644 --- a/docs/nbdkit-filter.pod +++ b/docs/nbdkit-filter.pod @@ -6,8 +6,6 @@ nbdkit-filter - how to write nbdkit filters #include <nbdkit-filter.h> - #define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL - static int myfilter_config (nbdkit_next_config *next, void *nxdata, const char *key, const char *value) @@ -107,24 +105,6 @@ should not expect to distribute filters separately from nbdkit. All filters should start by including this header file. -=head1 C<#de...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...src/connections.c b/src/connections.c index 74bb8e4..921a5b2 100644 --- a/src/connections.c +++ b/src/connections.c @@ -211,16 +211,17 @@ _handle_single_connection (int sockin, int sockout) int nworkers = threads ? threads : DEFAULT_PARALLEL_REQUESTS; pthread_t *workers = NULL; - if (plugin_thread_model () < NBDKIT_THREAD_MODEL_PARALLEL || nworkers == 1) + if (backend->thread_model (backend) < NBDKIT_THREAD_MODEL_PARALLEL || + nworkers == 1) nworkers = 0; conn = new_connection (sockin, sockout, nworkers); if (!conn) goto done; - if (plugin_open (conn, readonly) ==...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...src/connections.c b/src/connections.c index 74bb8e4..921a5b2 100644 --- a/src/connections.c +++ b/src/connections.c @@ -211,16 +211,17 @@ _handle_single_connection (int sockin, int sockout) int nworkers = threads ? threads : DEFAULT_PARALLEL_REQUESTS; pthread_t *workers = NULL; - if (plugin_thread_model () < NBDKIT_THREAD_MODEL_PARALLEL || nworkers == 1) + if (backend->thread_model (backend) < NBDKIT_THREAD_MODEL_PARALLEL || + nworkers == 1) nworkers = 0; conn = new_connection (sockin, sockout, nworkers); if (!conn) goto done; - if (plugin_open (conn, readonly) ==...
2019 Aug 15
2
[nbdkit PATCH] ocaml: Add support for dynamic .thread_model
...ins/ocaml/ocaml.c b/plugins/ocaml/ocaml.c index f664a7fb..01f4448f 100644 --- a/plugins/ocaml/ocaml.c +++ b/plugins/ocaml/ocaml.c @@ -72,6 +72,7 @@ static void remove_roots (void); static struct nbdkit_plugin plugin = { ._struct_size = sizeof (plugin), ._api_version = NBDKIT_API_VERSION, + ._thread_model = NBDKIT_THREAD_MODEL_PARALLEL, /* The following field is used as a canary to detect whether the * OCaml code started up and called us back successfully. If it's @@ -131,6 +132,8 @@ static value extents_fn; static value can_cache_fn; static value cache_fn; +static value thread_model...
2019 Jun 11
3
[nbdkit PATCH 0/2] Few rust plugin fixups/nitpicks
There are few more things that could be cleaned up related to the coding style and other things, like explicitly specifying the abi style after "extern" (i.e. `extern "C" fn` instead of `extern fn`), but since those are configurable in rustfmt config, I'm not sure whether the config needs to be added or complying with the defaults should be the priority. But this was just
2019 Aug 02
0
[nbdkit PATCH v2 10/17] plugins: Add .fork_safe field
...ted in one thread to a child process +created in another (either by always using atomic C<FD_CLOEXEC>, or by +closing unexpected fds between fork and exec). On platforms where +this is 0 and nbdkit cannot atomically set C<FD_CLOEXEC>, the thread +model will be restricted to +C<NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS> to avoid leaking file +descriptors. + =back =head1 THREADS @@ -942,8 +954,9 @@ C<NBDKIT_REGISTER_PLUGIN>). Additionally, a plugin may implement the C<.thread_model> callback, called right after C<.config_complete> to make a runtime decision on whic...
2020 Mar 23
0
[PATCH nbdkit 1/3] include: Function indirection for PE DLL
...(void) \ + { \ + (plugin)._struct_size = sizeof (plugin); \ + (plugin)._api_version = NBDKIT_API_VERSION; \ + (plugin)._thread_model = THREAD_MODEL; \ + return &(plugin); \ + } \ + NBDKIT_CXX_LANG_C __declspec(dllexport) \ + void...