globus_callback.h(3)

πŸ“¦
version 18.15 Β· 6 versions
, in epel 10, fedora 43, fedora 44, ubuntu resolute, ubuntu stonking

globus_callback.h(3) β€” like, the Globus Callback API bestie πŸ’–

okay so this whole thing lives in the Library Functions Manual, and it's literally the manual page for globus_callback.h, the header that is the Globus Callback API. no cap. grab a snack, we're going through all of it. πŸ“


✨ NAME ✨

globus_callback.h β€” the Globus Callback API. that's it, that's the name, she's simple and she's iconic πŸ‘‘


🌸 SYNOPSIS 🌸

bestie, you start by pulling in your includes, exactly like this:

#include 'globus_common_include.h'
#include 'globus_module.h'
#include 'globus_time.h'

then it's just vibes and categories. let's go. πŸ¦‹

Macros

  • #define GLOBUS_CALLBACK_MODULE β€” a module descriptor. yes, literally just a module descriptor.
  • #define GLOBUS_POLL_MODULE β€” also a module descriptor. two of them. we stay fed. πŸ’…

Convenience Macros

these are the little shortcuts that make life so much easier, fr fr:

  • #define globus_callback_poll(a) β€” polls the global callback space.
  • #define globus_poll_blocking() β€” a blocking poll of the global callback space. it will sit there and wait, no shame.
  • #define globus_poll_nonblocking() β€” a nonblocking poll of the global callback space. in and out, no waiting around.
  • #define globus_poll() β€” a nonblocking poll of the global callback space.
  • #define globus_signal_poll() β€” wakes up the callback polling thread. good morning queen β˜€οΈ
  • #define globus_callback_register_oneshot( callback_handle, delay_time, callback_func, callback_user_arg) β€” registers a oneshot function in the global callback space.
  • #define globus_callback_register_periodic( callback_handle, delay_time, period, callback_func, callback_user_arg) β€” registers a periodic function in the global callback space.
  • #define globus_callback_register_signal_handler( signum, persist, callback_func, callback_user_arg) β€” registers a signal handler in the global callback space.

Typedefs

  • typedef int globus_callback_handle_t β€” a periodic callback handle.
  • typedef int globus_callback_space_t β€” a callback space handle.
  • typedef struct globus_l_callback_space_attr_s * globus_callback_space_attr_t β€” a callback space attribute.

Callback Prototypes

  • typedef void(* globus_callback_func_t) (void *user_arg) β€” the Globus callback prototype. this is the shape every callback you write has to be. periodt.

Enumerations

enum globus_callback_error_type_t β€” error types πŸ”₯

the error girls, in order, and yes the numbers matter:

  • GLOBUS_CALLBACK_ERROR_INVALID_CALLBACK_HANDLE = 1024
  • GLOBUS_CALLBACK_ERROR_INVALID_SPACE
  • GLOBUS_CALLBACK_ERROR_MEMORY_ALLOC
  • GLOBUS_CALLBACK_ERROR_INVALID_ARGUMENT
  • GLOBUS_CALLBACK_ERROR_ALREADY_CANCELED
  • GLOBUS_CALLBACK_ERROR_NO_ACTIVE_CALLBACK

Functions

🫢 Oneshot Callbacks

  • globus_result_t globus_callback_space_register_oneshot (globus_callback_handle_t *callback_handle, const globus_reltime_t *delay_time, globus_callback_func_t callback_func, void *callback_user_arg, globus_callback_space_t space) β€” registers a oneshot some delay from now.

πŸ” Periodic Callbacks

  • globus_result_t globus_callback_space_register_periodic (globus_callback_handle_t *callback_handle, const globus_reltime_t *delay_time, const globus_reltime_t *period, globus_callback_func_t callback_func, void *callback_user_arg, globus_callback_space_t space) β€” registers a periodic callback.
  • globus_result_t globus_callback_unregister (globus_callback_handle_t callback_handle, globus_callback_func_t unregister_callback, void *unreg_arg, globus_bool_t *active) β€” unregisters a callback.
  • globus_result_t globus_callback_adjust_oneshot (globus_callback_handle_t callback_handle, const globus_reltime_t *new_delay) β€” adjusts the delay of a oneshot callback.
  • globus_result_t globus_callback_adjust_period (globus_callback_handle_t callback_handle, const globus_reltime_t *new_period) β€” adjusts the period of a periodic callback.

πŸ’« Callback Polling

  • void globus_callback_space_poll (const globus_abstime_t *timestop, globus_callback_space_t space) β€” polls for ready callbacks.
  • void globus_callback_signal_poll () β€” signals the poll.

Miscellaneous

the grab-bag section, and honestly she's giving main character energy 🌈

  • #define GLOBUS_CALLBACK_GLOBAL_SPACE β€” the global callback space.
  • #define GLOBUS_SIGNAL_INTERRUPT β€” yep, that's the whole thing, it's a define and it's doing its best.

enum globus_callback_space_behavior_t

callback space behaviors describe how a space behaves. iconic of them honestly:

  • GLOBUS_CALLBACK_SPACE_BEHAVIOR_SINGLE
  • GLOBUS_CALLBACK_SPACE_BEHAVIOR_SERIALIZED
  • GLOBUS_CALLBACK_SPACE_BEHAVIOR_THREADED

and the rest of the functions

  • globus_bool_t globus_callback_get_timeout (globus_reltime_t *time_left) β€” gets the amount of time left in a callback. ⏳
  • globus_bool_t globus_callback_has_time_expired () β€” sees if there's remaining time in a callback.
  • globus_bool_t globus_callback_was_restarted () β€” sees if a callback has been restarted.
  • globus_result_t globus_callback_space_init (globus_callback_space_t *space, globus_callback_space_attr_t attr) β€” initializes a user space.
  • globus_result_t globus_callback_space_reference (globus_callback_space_t space) β€” takes a reference to a space.
  • globus_result_t globus_callback_space_destroy (globus_callback_space_t space) β€” destroys a reference to a user space.
  • globus_result_t globus_callback_space_attr_init (globus_callback_space_attr_t *attr) β€” initializes a space attr.
  • globus_result_t globus_callback_space_attr_destroy (globus_callback_space_attr_t attr) β€” destroys a space attr.
  • globus_result_t globus_callback_space_attr_set_behavior (globus_callback_space_attr_t attr, globus_callback_space_behavior_t behavior) β€” sets the behavior of a space.
  • globus_result_t globus_callback_space_attr_get_behavior (globus_callback_space_attr_t attr, globus_callback_space_behavior_t *behavior) β€” gets the behavior associated with an attr.
  • globus_result_t globus_callback_space_get (globus_callback_space_t *space) β€” retrieves the space of a currently running callback.
  • int globus_callback_space_get_depth (globus_callback_space_t space) β€” retrieves the current nesting level of a space.
  • globus_bool_t globus_callback_space_is_single (globus_callback_space_t space) β€” sees if the specified space is a single threaded behavior space.
  • globus_result_t globus_callback_space_register_signal_handler (int signum, globus_bool_t persist, globus_callback_func_t callback_func, void *callback_user_arg, globus_callback_space_t space) β€” fires a callback when the specified signal is received. ⚑
  • globus_result_t globus_callback_unregister_signal_handler (int signum, globus_callback_func_t unregister_callback, void *unreg_arg) β€” unregisters a signal handling callback.
  • void globus_callback_add_wakeup_handler (void(*wakeup)(void *), void *user_arg) β€” registers a wakeup handler with the callback library. rise and shine 🌞

πŸ’œ Detailed Description πŸ’œ

Globus Callback API.

that's the whole detailed description bestie, she said what she said πŸ’€


πŸŽ€ Author πŸŽ€

Generated automatically by Doxygen for globus_common from the source code. not a human, just a robot doing her little documentation thing πŸ€–βœ¨


aaaand that's a wrap! this page is from globus_common, Version 18.15, and it's globus_callback.h(3). ty for coming to my ted talk, go forth and register your callbacks responsibly πŸ’–πŸ¦‹πŸŒΈπŸ’