ACE 8.0.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
ACE_DLL_Manager Class Reference

This class is a singleton and serves as a factory and repository for instances of ACE_DLL_Handle. More...

#include <DLL_Manager.h>

Collaboration diagram for ACE_DLL_Manager:
Collaboration graph
[legend]

Public Types

enum  { DEFAULT_SIZE = ACE_DEFAULT_DLL_MANAGER_SIZE }
 

Public Member Functions

ACE_DLL_Handleopen_dll (const ACE_TCHAR *dll_name, int openmode, ACE_SHLIB_HANDLE handle, ACE_DLL_Handle::ERROR_STACK *errors=0)
 
int close_dll (const ACE_TCHAR *dll_name)
 Close the underlying dll. Decrements the refcount.
 
u_long unload_policy () const
 Returns the current per-process UNLOAD_POLICY.
 
void unload_policy (u_long unload_policy)
 

Static Public Member Functions

static ACE_DLL_Managerinstance (int size=ACE_DLL_Manager::DEFAULT_SIZE)
 Return a unique instance.
 

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 

Protected Member Functions

 ACE_DLL_Manager (int size=ACE_DLL_Manager::DEFAULT_SIZE)
 Default constructor.
 
 ~ACE_DLL_Manager ()
 Destructor.
 
int open (int size)
 Allocate handle_vector_.
 
int close ()
 Close all open dlls and deallocate memory.
 
ACE_DLL_Handlefind_dll (const ACE_TCHAR *dll_name) const
 Find dll in handle_vector_.
 
int unload_dll (ACE_DLL_Handle *dll_handle, int force_unload=0)
 Applies strategy for unloading dll.
 

Private Member Functions

 ACE_DLL_Manager (const ACE_DLL_Manager &)=delete
 
void operator= (const ACE_DLL_Manager &)=delete
 
 ACE_DLL_Manager (ACE_DLL_Manager &&)=delete
 
void operator= (ACE_DLL_Manager &&)=delete
 

Static Private Member Functions

static void close_singleton ()
 Close the singleton instance.
 

Private Attributes

ACE_DLL_Handle ** handle_vector_
 Vector containing all loaded handle objects.
 
int current_size_
 Current number of handles.
 
int total_size_
 Maximum number of handles.
 
u_long unload_policy_
 Unload strategy.
 

Static Private Attributes

static ACE_DLL_Managerinstance_ = 0
 Pointer to a process-wide ACE_DLL_Manager.
 

Friends

class ACE_Framework_Repository
 
class ACE_Object_Manager
 

Detailed Description

This class is a singleton and serves as a factory and repository for instances of ACE_DLL_Handle.

This class is a singleton whose lifetime is managed by the ACE_Framework_Repository. Although it is normally meant to be used directly only by ACE_DLL, applications can call the unload_policy() methods in order get/set the the dll unload policy. Unload policies include per_process/per-dll and eager/lazy. Dlls can export set their own policy by using the ACE_DLL_UNLOAD_POLICY macro found in config-all.h. If a dll choses to set an unload policy, it will be used when the per-dll policy (the default) is in effect. If the per-dll policy is in effect and a dll has not chosen to set a policy, the current per-process policy will be used.

The following policy macros are provided in config-all.h:

ACE_DLL_UNLOAD_POLICY_PER_PROCESS - Per-process policy that unloads dlls eagerly.

ACE_DLL_UNLOAD_POLICY_PER_DLL - Apply policy on a per-dll basis. If the dll doesn't use one of the macros below, the current per-process policy will be used.

ACE_DLL_UNLOAD_POLICY_LAZY - Don't unload dll when refcount reaches zero, i.e., wait for either an explicit unload request or program exit.

ACE_DLL_UNLOAD_POLICY_DEFAULT - Default policy allows dlls to control their own destinies, but will unload those that don't make a choice eagerly.

Member Enumeration Documentation

◆ anonymous enum

Enumerator
DEFAULT_SIZE 

Constructor & Destructor Documentation

◆ ACE_DLL_Manager() [1/3]

ACE_DLL_Manager::ACE_DLL_Manager ( int size = ACE_DLL_Manager::DEFAULT_SIZE)
protected

Default constructor.

◆ ~ACE_DLL_Manager()

ACE_DLL_Manager::~ACE_DLL_Manager ( )
protected

Destructor.

◆ ACE_DLL_Manager() [2/3]

ACE_DLL_Manager::ACE_DLL_Manager ( const ACE_DLL_Manager & )
privatedelete

◆ ACE_DLL_Manager() [3/3]

ACE_DLL_Manager::ACE_DLL_Manager ( ACE_DLL_Manager && )
privatedelete

Member Function Documentation

◆ close()

int ACE_DLL_Manager::close ( )
protected

Close all open dlls and deallocate memory.

◆ close_dll()

int ACE_DLL_Manager::close_dll ( const ACE_TCHAR * dll_name)

Close the underlying dll. Decrements the refcount.

◆ close_singleton()

void ACE_DLL_Manager::close_singleton ( )
staticprivate

Close the singleton instance.

◆ find_dll()

ACE_DLL_Handle * ACE_DLL_Manager::find_dll ( const ACE_TCHAR * dll_name) const
protected

Find dll in handle_vector_.

◆ instance()

ACE_DLL_Manager * ACE_DLL_Manager::instance ( int size = ACE_DLL_Manager::DEFAULT_SIZE)
static

Return a unique instance.

◆ open()

int ACE_DLL_Manager::open ( int size)
protected

Allocate handle_vector_.

◆ open_dll()

ACE_DLL_Handle * ACE_DLL_Manager::open_dll ( const ACE_TCHAR * dll_name,
int openmode,
ACE_SHLIB_HANDLE handle,
ACE_DLL_Handle::ERROR_STACK * errors = 0 )

Factory for ACE_DLL_Handle objects. If one already exits, its refcount is incremented.

◆ operator=() [1/2]

void ACE_DLL_Manager::operator= ( ACE_DLL_Manager && )
privatedelete

◆ operator=() [2/2]

void ACE_DLL_Manager::operator= ( const ACE_DLL_Manager & )
privatedelete

◆ unload_dll()

int ACE_DLL_Manager::unload_dll ( ACE_DLL_Handle * dll_handle,
int force_unload = 0 )
protected

Applies strategy for unloading dll.

◆ unload_policy() [1/2]

u_long ACE_DLL_Manager::unload_policy ( ) const

Returns the current per-process UNLOAD_POLICY.

◆ unload_policy() [2/2]

void ACE_DLL_Manager::unload_policy ( u_long unload_policy)

Set the per-process UNLOAD_POLICY. If the policy is changed from LAZY to EAGER, then it will also unload any dlls with zero refcounts.

Friends And Related Symbol Documentation

◆ ACE_Framework_Repository

◆ ACE_Object_Manager

Member Data Documentation

◆ ACE_ALLOC_HOOK_DECLARE

ACE_DLL_Manager::ACE_ALLOC_HOOK_DECLARE

◆ current_size_

int ACE_DLL_Manager::current_size_
private

Current number of handles.

◆ handle_vector_

ACE_DLL_Handle** ACE_DLL_Manager::handle_vector_
private

Vector containing all loaded handle objects.

◆ instance_

ACE_DLL_Manager * ACE_DLL_Manager::instance_ = 0
staticprivate

Pointer to a process-wide ACE_DLL_Manager.

◆ total_size_

int ACE_DLL_Manager::total_size_
private

Maximum number of handles.

◆ unload_policy_

u_long ACE_DLL_Manager::unload_policy_
private

Unload strategy.


The documentation for this class was generated from the following files: