lib/event: add asserts that reactors aren't NULL.

In practice, the reactor pointers will never be NULL
in these cases, but some static analysis tools don't
realize that.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I0657959e5572df2741398b179907f2bbf0b02b3b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1984
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Seth Howell 2020-04-22 16:45:27 -07:00 committed by Tomasz Zawadzki
parent fe089ae0cb
commit 2e69975fab
2 changed files with 4 additions and 1 deletions

View File

@ -154,8 +154,9 @@ spdk_reactors_fini(void)
SPDK_ENV_FOREACH_CORE(i) {
reactor = spdk_reactor_get(i);
assert(reactor != NULL);
assert(reactor->thread_count == 0);
if (spdk_likely(reactor != NULL) && reactor->events != NULL) {
if (reactor->events != NULL) {
spdk_ring_free(reactor->events);
}
}

View File

@ -374,6 +374,8 @@ rpc_framework_get_reactors(void *arg1, void *arg2)
current_core = spdk_env_get_current_core();
reactor = spdk_reactor_get(current_core);
assert(reactor != NULL);
spdk_json_write_object_begin(ctx->w);
spdk_json_write_named_uint32(ctx->w, "lcore", current_core);
spdk_json_write_named_uint64(ctx->w, "busy", reactor->busy_tsc);