I'm using spdk_thread_create to provide single-threaded context for the
operations that otherwise would require locking. Everything runs nice up to
exiting/destroying such a thread. In particular, after calling
spdk_thread_exit I'm witnessing thread being unable to process pending
messages (such as _spdk_put_io_channel which are generated by
spdk_put_io_channel issued on the exiting thread before calling
spdk_thread_exit), and destroying thread at this doesn't seem safe.
Is there any recommended procedure to be followed before calling
thread_exit so that the thread consumes all outstanding messages and is safe
to destroy? I would assume something like
while (spdk_thread_poll(thread) > 0);
should do the trick, but I'd prefer to rely on a recommended procedure.