mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-06 18:29:50 +09:00
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:
committed by
Andreas Schneider
parent
0a450f0251
commit
a99b8a3979
19
src/init.c
19
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;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
Reference in New Issue
Block a user