diff options
author | Martin Willi <martin@revosec.ch> | 2014-07-10 16:27:18 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2014-09-24 11:19:59 +0200 |
commit | 5ea627bdfad4026ca6cc4fe87f6f1959b8b057fe (patch) | |
tree | fea915e3c07cb4e81186f5b09d16e1969fe9716d /src/libstrongswan/processing/watcher.h | |
parent | 12c0bde6891b5ed21807116d0ab7e8d07e0c5290 (diff) | |
download | strongswan-5ea627bdfad4026ca6cc4fe87f6f1959b8b057fe.tar.bz2 strongswan-5ea627bdfad4026ca6cc4fe87f6f1959b8b057fe.tar.xz |
watcher: Add a method to query the watcher state
This allows a user to check if the watcher is actually running, and potentially
perform read operations directly instead of relying on watcher.
Diffstat (limited to 'src/libstrongswan/processing/watcher.h')
-rw-r--r-- | src/libstrongswan/processing/watcher.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libstrongswan/processing/watcher.h b/src/libstrongswan/processing/watcher.h index 6e158cec2..f5ecceeb7 100644 --- a/src/libstrongswan/processing/watcher.h +++ b/src/libstrongswan/processing/watcher.h @@ -23,6 +23,7 @@ typedef struct watcher_t watcher_t; typedef enum watcher_event_t watcher_event_t; +typedef enum watcher_state_t watcher_state_t; #include <library.h> @@ -57,6 +58,18 @@ enum watcher_event_t { }; /** + * State the watcher currently is in + */ +enum watcher_state_t { + /** no watcher thread running or queued */ + WATCHER_STOPPED = 0, + /** a job has been queued for watching, but not yet started */ + WATCHER_QUEUED, + /** a watcher thread is active, dispatching socket events */ + WATCHER_RUNNING, +}; + +/** * Watch multiple file descriptors using select(). */ struct watcher_t { @@ -86,6 +99,13 @@ struct watcher_t { void (*remove)(watcher_t *this, int fd); /** + * Get the current watcher state + * + * @reutrn currently active watcher state + */ + watcher_state_t (*get_state)(watcher_t *this); + + /** * Destroy a watcher_t. */ void (*destroy)(watcher_t *this); |