Mercurial > octave
comparison liboctave/util/oct-shlib.cc @ 30749:076e19eac74a stable
allow deletion of dynamic_library objects to be delayed
* oct-shlib.h, oct-shlib.cc (dynamic_library::delete_later):
New function.
(possibly_unreferenced_dynamic_libraries): New static object.
(release_unreferenced_dynamic_libraries): New function.
* interpreter.cc (interpreter::main_loop):
Add release_unreferenced_dynamic_libraries as new event_hook.
* pt-eval.cc (debugger::server_loop, tree_evaluator::server_loop):
Also call release_unreferenced_dynamic_libraries in event loop.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 17 Feb 2022 22:21:03 -0500 |
parents | bfff3d523690 |
children | e88a07dec498 |
comparison
equal
deleted
inserted
replaced
30748:e00154c0a71b | 30749:076e19eac74a |
---|---|
25 | 25 |
26 #if defined (HAVE_CONFIG_H) | 26 #if defined (HAVE_CONFIG_H) |
27 # include "config.h" | 27 # include "config.h" |
28 #endif | 28 #endif |
29 | 29 |
30 #include <list> | |
30 #include <map> | 31 #include <map> |
31 | 32 |
32 extern "C" | 33 extern "C" |
33 { | 34 { |
34 #if defined (HAVE_DLOPEN_API) | 35 #if defined (HAVE_DLOPEN_API) |
57 # include "lo-sysdep.h" | 58 # include "lo-sysdep.h" |
58 #endif | 59 #endif |
59 | 60 |
60 namespace octave | 61 namespace octave |
61 { | 62 { |
63 std::list<dynamic_library> possibly_unreferenced_dynamic_libraries; | |
64 | |
65 void dynamic_library::delete_later (void) | |
66 { | |
67 possibly_unreferenced_dynamic_libraries.push_back (*this); | |
68 } | |
69 | |
70 int release_unreferenced_dynamic_libraries (void) | |
71 { | |
72 possibly_unreferenced_dynamic_libraries.clear (); | |
73 | |
74 return 0; | |
75 } | |
76 | |
62 dynamic_library::dynlib_rep::dynlib_rep (const std::string& f) | 77 dynamic_library::dynlib_rep::dynlib_rep (const std::string& f) |
63 : m_count (1), m_fcn_names (), m_file (f), m_time_loaded (), | 78 : m_count (1), m_fcn_names (), m_file (f), m_time_loaded (), |
64 m_search_all_loaded (false) | 79 m_search_all_loaded (false) |
65 { | 80 { |
66 s_instances[f] = this; | 81 s_instances[f] = this; |