From a0fe5cdea15bca52d3b101a88c11cb160ef08b2f Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 22 Oct 2015 15:57:59 +0200 Subject: Documentation update --- pcilib/event.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'pcilib/event.c') diff --git a/pcilib/event.c b/pcilib/event.c index 2fc77ab..6b37dac 100644 --- a/pcilib/event.c +++ b/pcilib/event.c @@ -147,6 +147,9 @@ int pcilib_configure_preprocessing_threads(pcilib_t *ctx, size_t max_threads) { } int pcilib_start(pcilib_t *ctx, pcilib_event_t event_mask, pcilib_event_flags_t flags) { + int err; + pcilib_register_value_t max_threads; + const pcilib_event_api_description_t *api; const pcilib_model_description_t *model_info = pcilib_get_model_description(ctx); @@ -156,6 +159,12 @@ int pcilib_start(pcilib_t *ctx, pcilib_event_t event_mask, pcilib_event_flags_t return PCILIB_ERROR_NOTSUPPORTED; } + err = pcilib_read_register(ctx, "conf", "max_threads", &max_threads); + if (!err) { + err = pcilib_configure_preprocessing_threads(ctx, max_threads); + if (err) pcilib_warning("Error (%i) configuring number of preprocessing threads", err); + } + if (api->start) return api->start(ctx->event_ctx, event_mask, flags); @@ -430,7 +439,12 @@ int pcilib_grab(pcilib_t *ctx, pcilib_event_t event_mask, size_t *size, void **d pcilib_grab_callback_user_data_t user = {ctx, size, data}; err = pcilib_start(ctx, event_mask, PCILIB_EVENT_FLAGS_DEFAULT); - if (!err) err = pcilib_trigger(ctx, event_mask, 0, NULL); + if (!err) { + if (timeout == PCILIB_TIMEOUT_IMMEDIATE) { + err = pcilib_trigger(ctx, event_mask, 0, NULL); + timeout = PCILIB_EVENT_TIMEOUT; + } + } if (!err) { err = pcilib_get_next_event(ctx, timeout, &eid, 0, NULL); if (!err) pcilib_grab_callback(event_mask, eid, &user); -- cgit v1.2.3