#include <pool.h>
Collaboration diagram for ModulePool:
Public Member Functions | |
~ModulePool () | |
Static Public Member Functions | |
int | init () |
Initialize the module pool (manger). | |
void | cleanup () |
Cleanup module pool (manager). | |
SharedObject | load (const char *name, int flags=0) |
Load a module / shared object / DLL. | |
int | unload (const char *name) |
Force unloading of a module / shared object / DLL; DO NOT USE. | |
void | unregister (_ISharedObject *iso) |
Internal unregistration functions of shared objects called by their destructor. | |
Private Member Functions | |
SharedObject | _load (const char *name, int flags) |
Internally used method to load a shared object. | |
int | _unload (const char *name) |
Internally used method for forced unloading of a shared object. | |
void | _unregister (_ISharedObject *iso) |
Internally used method for shared object de-registration. | |
_ISharedObject * | _FindObjectByName (const char *name, bool requeue) |
Find module with passed name in list of loaded modules. | |
ModulePool (const ModulePool &) | |
Do use this class directly; just its static members. | |
void | operator= (const ModulePool &) |
ModulePool () | |
Do use this class directly; just its static members. | |
Private Attributes | |
LinkedList< _ISharedObject > | so_list |
List of all shared objects currently loaded. | |
RecursiveMutex | pool_mutex |
Mutex to protect the module pool:. | |
Static Private Attributes | |
ModulePool * | pool = NULL |
Static module pool manager; created by init(). |
Definition at line 136 of file pool.h.
|
Do use this class directly; just its static members.
|
|
Do use this class directly; just its static members.
Definition at line 144 of file pool.cc. Referenced by init(). |
|
Definition at line 153 of file pool.cc. References _unregister(), Assert, LinkedList< _ISharedObject >::first(), LinkedList< _ISharedObject >::IsEmpty(), RecursiveMutex::lock(), pool, pool_mutex, so_list, and RecursiveMutex::unlock(). |
|
Find module with passed name in list of loaded modules.
Definition at line 26 of file pool.cc. References LinkedList< _ISharedObject >::dequeue(), LinkedList< _ISharedObject >::first(), LinkedList< _ISharedObject >::insert(), RecursiveMutex::lock(), _ISharedObject::mname, LinkedListBase< _ISharedObject >::next, pool_mutex, so_list, and RecursiveMutex::unlock(). |
|
Internally used method to load a shared object.
Definition at line 51 of file pool.cc. References _FindObjectByName(), LinkedList< _ISharedObject >::insert(), RecursiveMutex::lock(), pool_mutex, SharedObject, so_list, and RecursiveMutex::unlock(). Referenced by load(). |
|
Internally used method for forced unloading of a shared object.
Definition at line 85 of file pool.cc. References _FindObjectByName(), and _unregister(). Referenced by unload(). |
|
Internally used method for shared object de-registration.
Definition at line 99 of file pool.cc. References LinkedList< _ISharedObject >::dequeue(), RecursiveMutex::lock(), _ISharedObject::module, _ISharedObject::name(), pool_mutex, so_list, and RecursiveMutex::unlock(). Referenced by _unload(), unregister(), and ~ModulePool(). |
|
Cleanup module pool (manager). The opposite of init(). Definition at line 136 of file pool.cc. References pool. |
|
Initialize the module pool (manger). In order to use the shared objects, you must first initialize the shared object pool using ModulePool::init(), normally from the main thread.
Definition at line 122 of file pool.cc. References ModulePool(). |
|
Load a module / shared object / DLL. This function will load a shared object. It can be safely called (e.g. by different threads but also by the same thread) several times with the same module file as argument; in this case, always the same reference will be returned. The flags is a bitwise OR of the _ISharedObject_Namespace::Flags, i.e.:
The returned SharedObject is "C++-safe" and used ref couning. Definition at line 214 of file pool.h. References _load(), pool, and SharedObject. |
|
|
|
Force unloading of a module / shared object / DLL; DO NOT USE. This function will unload the specified shared object no matter if it is still used or not. DO NOT USE. IT WILL MOST LIKELY CRASH YOUR APPLICATION. Shared objects are automatically unloaded if they are no longer in use, i.e. once all SharedObject and ModuleFunction instances referring to that shared object got destroyed.
|
|
Internal unregistration functions of shared objects called by their destructor.
For internal use only.
Definition at line 239 of file pool.h. References _unregister(), and pool. Referenced by _ISharedObject::~_ISharedObject(). |
|
Static module pool manager; created by init().
Definition at line 23 of file pool.cc. Referenced by cleanup(), load(), ModulePool(), unload(), unregister(), and ~ModulePool(). |
|
Mutex to protect the module pool:.
Definition at line 152 of file pool.h. Referenced by _FindObjectByName(), _load(), _unregister(), and ~ModulePool(). |
|
List of all shared objects currently loaded. We can use a list here since we will normally deal with few shared objects and the elemets are LRU-requeued as some sort of caching. May be replaced by a balanced tree if needed. Definition at line 150 of file pool.h. Referenced by _FindObjectByName(), _load(), _unregister(), and ~ModulePool(). |