thread.h: document expected poller return values.
Code isn't alway consistent (for legacy reasons) so lets at least document what we expect moving forward. Signed-off-by: paul Luse <paul.e.luse@intel.com> Change-Id: Iba9e383ae89ec9f850dcacca45c3bf8410c3b28b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8582 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
d47893607b
commit
df3fe33ff4
@ -45,6 +45,10 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pollers should always return a value of this type
|
||||||
|
* indicating whether they did real work or not.
|
||||||
|
*/
|
||||||
enum spdk_thread_poller_rc {
|
enum spdk_thread_poller_rc {
|
||||||
SPDK_POLLER_IDLE,
|
SPDK_POLLER_IDLE,
|
||||||
SPDK_POLLER_BUSY,
|
SPDK_POLLER_BUSY,
|
||||||
@ -117,9 +121,8 @@ typedef void (*spdk_thread_pass_msg)(spdk_msg_fn fn, void *ctx,
|
|||||||
* Callback function for a poller.
|
* Callback function for a poller.
|
||||||
*
|
*
|
||||||
* \param ctx Context passed as arg to spdk_poller_register().
|
* \param ctx Context passed as arg to spdk_poller_register().
|
||||||
* \return 0 to indicate that polling took place but no events were found;
|
* \return value of type `enum spdk_thread_poller_rc` (ex: SPDK_POLLER_IDLE
|
||||||
* positive to indicate that polling took place and some events were processed;
|
* if no work was done or SPDK_POLLER_BUSY if work was done.)
|
||||||
* negative if the poller does not provide spin-wait information.
|
|
||||||
*/
|
*/
|
||||||
typedef int (*spdk_poller_fn)(void *ctx);
|
typedef int (*spdk_poller_fn)(void *ctx);
|
||||||
|
|
||||||
@ -561,7 +564,9 @@ struct spdk_poller *spdk_poller_register_named(spdk_poller_fn fn,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Register a poller on the current thread with setting its name
|
* \brief Register a poller on the current thread with setting its name
|
||||||
* to the string of the poller function name.
|
* to the string of the poller function name. The poller being registered
|
||||||
|
* should return a value of type `enum spdk_thread_poller_rc`. See
|
||||||
|
* \ref spdk_poller_fn for more information.
|
||||||
*/
|
*/
|
||||||
#define SPDK_POLLER_REGISTER(fn, arg, period_microseconds) \
|
#define SPDK_POLLER_REGISTER(fn, arg, period_microseconds) \
|
||||||
spdk_poller_register_named(fn, arg, period_microseconds, #fn)
|
spdk_poller_register_named(fn, arg, period_microseconds, #fn)
|
||||||
|
Loading…
Reference in New Issue
Block a user