omni::core::OnModuleCanUnloadFn

Defined in omni/core/ModuleExports.h

using omni::core::OnModuleCanUnloadFn = bool()

Called to determine if the module can be unloaded.

Return true if it is safe to unload the module. It is up to the module to determine what “safe” means, though in general, it is expected that “safe” means that none of the objects created from the module’s createFn’s are still alive.

This function will never be called while another thread is calling one of this module’s createFn functions, during omni::core::OnModuleLoadFn, or during omni::core::OnModuleStartedFn.

omni::core::OnModuleCanUnloadFn access the owning omni::core::ITypeFactory. omni::core::ITypeFactory is unable to prevent this, thus, if omni::core::OnModuleCanUnloadFn does access omni::core::ITypeFactory (either directly or indirectly) there are no safety guards in place and undefined behavior will result.

If the module returns true from this function, omni::core::OnModuleUnloadFn will be called. If false is returned, omni::core::OnModuleUnloadFn will not be called.

If this function returns false, it may be called again. If true is returned, the module will be unloaded and this function will not be called until the module is loaded again (if ever).