lib/event: set thread for each event executed
Whenever an event executes, it might change the currently set thread or reset it to NULL. To prevent it from affecting other events, set the current thread each time an event executes. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I6f1e7f8b7acab25353b4782058e87a9e01aab2c8 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8045 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
a4bf3e1099
commit
0598e484d7
@ -605,17 +605,15 @@ event_queue_run_batch(struct spdk_reactor *reactor)
|
||||
thread = NULL;
|
||||
}
|
||||
|
||||
spdk_set_thread(thread);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
struct spdk_event *event = events[i];
|
||||
|
||||
assert(event != NULL);
|
||||
spdk_set_thread(thread);
|
||||
event->fn(event->arg1, event->arg2);
|
||||
spdk_set_thread(NULL);
|
||||
}
|
||||
|
||||
spdk_set_thread(NULL);
|
||||
|
||||
spdk_mempool_put_bulk(g_spdk_event_mempool, events, count);
|
||||
|
||||
return count;
|
||||
|
Loading…
Reference in New Issue
Block a user