aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2020-04-06 12:07:28 +0200
committerAndreas Schneider <asn@cryptomilk.org>2020-04-09 11:25:49 +0200
commitdba2114ed78796caa06fc9d53268cb9cc302699f (patch)
treec570b67dc5b55a47f9b4ecd2b64f265e5ea08ff5 /src
parente3e52394c11e7b9bafa3086e7be937388540daeb (diff)
downloadlibssh-dba2114ed78796caa06fc9d53268cb9cc302699f.tar.gz
libssh-dba2114ed78796caa06fc9d53268cb9cc302699f.tar.xz
libssh-dba2114ed78796caa06fc9d53268cb9cc302699f.zip
init: Introduce internal is_ssh_initialized()
The introduced function returns whether the library is initialized or not. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/init.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/init.c b/src/init.c
index edecb95e..2ebcedf6 100644
--- a/src/init.c
+++ b/src/init.c
@@ -261,4 +261,23 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
#endif /* _WIN32 */
+/**
+ * @internal
+ * @brief Return whether the library is initialized
+ *
+ * @returns true if the library is initialized; false otherwise.
+ *
+ * @see ssh_init()
+ */
+bool is_ssh_initialized() {
+
+ bool is_initialized = false;
+
+ ssh_mutex_lock(&ssh_init_mutex);
+ is_initialized = _ssh_initialized > 0;
+ ssh_mutex_unlock(&ssh_init_mutex);
+
+ return is_initialized;
+}
+
/** @} */