Overview | Namespace | Class | Index | Help |
rtl_unloadingListenerFunc | callback, |
void * | _this ); |
virtual | abstract | const | volatile | template | static | inline | C-linkage |
NO | NO | NO | NO | NO | NO | NO | YES |
rtl_unloadUnusedLibraries
. The second argument is used to distinguish between different
listener instances and may be NULL
. It will be passed as argument when the callback
function is being called. The return value identifies the registered listener and will
be used for removing the listener later on. If the same listener is added more then
once then every registration is treated as if made for a different listener. That is,
a different cookie is returned and the callback function will be called as many times
as it has been registered.
callback | - a function that is called to notify listeners. |
this | - a value to distinguish different listener instances |
rtl_ModuleCount * | that ); |
virtual | abstract | const | volatile | template | static | inline | C-linkage |
NO | NO | NO | NO | NO | NO | NO | YES |
rtl_ModuleCount.acquire
. Use this function along with
rtl_StandardModuleCount
.
rtl_StandardModuleCount * | that, |
TimeValue * | libUnused ); |
virtual | abstract | const | volatile | template | static | inline | C-linkage |
NO | NO | NO | NO | NO | NO | NO | YES |
component_canUnload
. Use this function along with
rtl_StandardModuleCount
.
rtl_ModuleCount * | that ); |
virtual | abstract | const | volatile | template | static | inline | C-linkage |
NO | NO | NO | NO | NO | NO | NO | YES |
rtl_ModuleCount.release
.
Use this function along with
rtl_StandardModuleCount
.
oslModule | module ); |
virtual | abstract | const | volatile | template | static | inline | C-linkage |
NO | NO | NO | NO | NO | NO | NO | YES |
osl_loadModule
within the same process. The
function will then return the same module handle because the library will
effectively only be loaded once. To remove the library from memory it is
necessary to call osl_unloadModule
as often as
osl_loadModule
was called. The
function rtl_unloadUnusedModules
calls osl_unloadModule
for a module as many
times as it was registered. If, for example, a module has been registered one
time less then osl_loadModule
has been called and the module can be unloaded
then it needs a call to rtl_unloadUnusedModules
and an explicit call to
osl_unloadModule
to remove the module from memory. A module must be registered every time it has been loaded otherwise the unloading mechanism is not effective.
Before a module is registered, one has to make sure that the module is in a
state that prevents it from being unloaded. In other words,
component_canUnload
must return sal_False
. Assuming that
component_canUnload
returns sal_True
and it is registered regardless, then a call to
rtl_unloadUnusedModules
causes the module to be unloaded. This unloading can
be set off by a different thread and the thread which registered the module is
"unaware" of this. Then when the first thread tries to obtain a factory or
calls another function in the module, the application will crash, because the
module has been unloaded before. Therefore one has to ensure that the module
cannot be unloaded before it is registered. This is simply done by obtaining a
factory from the module. As long as a factory or some other object, which has
been created by the factory, is alive, the component_canUnload
function will
return sal_False
.
Loading and registering have to be in this order:
osl_loadModule
)component_getFactory
function and get a factorymodule | a module handle as is obtained by osl_loadModule |
sal_Int32 | cookie ); |
virtual | abstract | const | volatile | template | static | inline | C-linkage |
NO | NO | NO | NO | NO | NO | NO | YES |
rtl_unloadingListenerFunc
, then those functions must not be
registered when component_canUnload
returns sal_True
.
cookie | is an identifier as returned by |
TimeValue * | libUnused ); |
virtual | abstract | const | volatile | template | static | inline | C-linkage |
NO | NO | NO | NO | NO | NO | NO | YES |
sal_True
is returned then osl_unloadModule
is called for the belonging module as often as it is registered.
A call to osl_unloadModule
does not guarantee that the module is unloaded even
if its component_canUnload
function returns sal_True
.
The optional in-parameter libUnused
specifies a period of time which a library
must be unused in order to qualify for being unloaded. By using this argument
one can counter the multithreading problem as described further above. It is in
the responsibility of the user of this function to provide a timespan big enough
to ensure that all threads are out of modules (see component_canUnload
).
The service managers which have been created by functions such as
createRegistryServiceFactory
(declared in cppuhelper/servicefactory.hxx) are
registered listeners and release the references to factories on notification.
libUnused | span of time that a module must be unused to be unloaded. the argument is optional. |
oslModule | module ); |
virtual | abstract | const | volatile | template | static | inline | C-linkage |
NO | NO | NO | NO | NO | NO | NO | YES |
rtl_unloadUnusedModules
unregisters the modules which it unloads. Therefore
there is no need to call this function unless one means to prevent the unloading of a module.
module | a module handle as is obtained by osl_loadModule |
Copyright 2002 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA.