Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[v1.9.x] stop closing opened libs (#20523)
Browse files Browse the repository at this point in the history
* stopped closing opened libs

* removed return handling from load

* missed one *lib

Co-authored-by: Skalicky <[email protected]>
  • Loading branch information
samskalicky and Skalicky committed Aug 18, 2021
1 parent 524be2f commit b5e9ae8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/mxnet/c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ MXNET_DLL const char *MXGetLastError();
/*!
* \brief Load library dynamically
* \param path to the library .so file
* \param 0 for quiet, 1 for verbose
* \param verbose 0 for quiet, 1 for verbose
* \return 0 when success, -1 when failure happens.
*/
MXNET_DLL int MXLoadLib(const char *path, unsigned verbose);
Expand Down
2 changes: 1 addition & 1 deletion python/mxnet/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def load(path, verbose=True):
Returns
---------
void
None
"""
#check if path exists
if not os.path.exists(path):
Expand Down
2 changes: 2 additions & 0 deletions src/c_api/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,8 @@ void registerPasses(void *lib, int verbose, mxnet::ext::msgSize_t msgSize,
/*!
* \brief Loads dynamic custom library and initializes it
* \param path library path
* \param verbose 0 for quiet, 1 for verbose
* \return 0 when success, -1 when failure happens.
*/
int MXLoadLib(const char *path, unsigned verbose) {
API_BEGIN();
Expand Down
4 changes: 0 additions & 4 deletions src/initialize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ LibraryInitializer::LibraryInitializer()
install_pthread_atfork_handlers();
}

LibraryInitializer::~LibraryInitializer() {
close_open_libs();
}

bool LibraryInitializer::lib_is_loaded(const std::string& path) const {
return loaded_libs.count(path) > 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/initialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class LibraryInitializer {
*/
LibraryInitializer();

~LibraryInitializer();
~LibraryInitializer() = default;

/**
* @return true if the current pid doesn't match the one that initialized the library
Expand Down

0 comments on commit b5e9ae8

Please sign in to comment.