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>
(cherry picked from commit dba2114ed7)
This commit is contained in:
Anderson Toshiyuki Sasaki
2020-04-06 12:07:28 +02:00
committed by Andreas Schneider
parent 0a450f0251
commit a99b8a3979
3 changed files with 45 additions and 0 deletions

View File

@@ -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;
}
/** @} */