Loading...
Searching...
No Matches
XrdCl::ForkHandler Class Reference

`#include <XrdClForkHandler.hh>`

Collaboration diagram for XrdCl::ForkHandler:

## Public Member Functions

| ForkHandler ()
void | Child ()
| Handler the child post-fork.
void | Parent ()
| Handle the parent post-fork.
void | Prepare ()
| Handle the preparation part of the forking process.
void | RegisterFileObject (FileStateHandler *file)
| Register a file object.
void | RegisterFileSystemObject (FileSystem *fs)
void | RegisterFileTimer (FileTimer *fileTimer)
void | RegisterPostMaster (PostMaster *postMaster)
| Register a post master object.
void | UnRegisterFileObject (FileStateHandler *file)
void | UnRegisterFileSystemObject (FileSystem *fs)
| Un-register a file system object.

## Detailed Description

Definition at line 35 of file XrdClForkHandler.hh.

## Constructor & Destructor Documentation

## ForkHandler()

XrdCl::ForkHandler::ForkHandler | ( |  | ) |

Definition at line 32 of file XrdClForkHandler.cc.

:
pPostMaster(0), pFileTimer(0)
{
}

## Member Function Documentation

## Child()

void XrdCl::ForkHandler::Child | ( |  | ) |

Handler the child post-fork.

Definition at line 102 of file XrdClForkHandler.cc.

{
Log *log = DefaultEnv::GetLog();
pid_t pid = getpid();
log->Debug( UtilityMsg, "Running the child fork handler for process %d",
pid );
log->Debug( UtilityMsg, "Unlocking File and FileSystem objects for "
"process: %d", pid );
std::set<FileStateHandler*>::iterator itFile;
for( itFile = pFileObjects.begin(); itFile != pFileObjects.end();
++itFile )
{
(*itFile)->AfterForkChild();
(*itFile)->UnLock();
}
std::set<FileSystem*>::iterator itFs;
for( itFs = pFileSystemObjects.begin(); itFs != pFileSystemObjects.end();
++itFs )
(*itFs)->UnLock();
pFileTimer->UnLock();
if( pPostMaster )
{
pPostMaster->Finalize();
pPostMaster->Initialize();
pPostMaster->Start();
pPostMaster->GetTaskManager()->RegisterTask( pFileTimer, time(0), false );
}
pMutex.UnLock();
}
XrdCl::DefaultEnv::GetLog
static Log * GetLog()
Get default log.
Definition XrdClDefaultEnv.cc:493
XrdCl::UtilityMsg
const uint64_t UtilityMsg
Definition XrdClConstants.hh:33
XrdGlobal::Log
XrdSysError Log
Definition XrdConfig.cc:113

References XrdCl::Log::Debug(), XrdCl::DefaultEnv::GetLog(), and XrdCl::UtilityMsg.

Referenced by child().

Here is the call graph for this function:
Here is the caller graph for this function:

## Parent()

void XrdCl::ForkHandler::Parent | ( |  | ) |

Handle the parent post-fork.

Definition at line 72 of file XrdClForkHandler.cc.

{
Log *log = DefaultEnv::GetLog();
pid_t pid = getpid();
log->Debug( UtilityMsg, "Running the parent fork handler for process %d",
pid );
log->Debug( UtilityMsg, "Unlocking File and FileSystem objects for "
"process: %d", pid );
std::set<FileStateHandler*>::iterator itFile;
for( itFile = pFileObjects.begin(); itFile != pFileObjects.end();
++itFile )
(*itFile)->UnLock();
std::set<FileSystem*>::iterator itFs;
for( itFs = pFileSystemObjects.begin(); itFs != pFileSystemObjects.end();
++itFs )
(*itFs)->UnLock();
pFileTimer->UnLock();
if( pPostMaster )
pPostMaster->Start();
pMutex.UnLock();
}

References XrdCl::Log::Debug(), XrdCl::DefaultEnv::GetLog(), and XrdCl::UtilityMsg.

Referenced by parent().

Here is the call graph for this function:
Here is the caller graph for this function:

## Prepare()

void XrdCl::ForkHandler::Prepare | ( |  | ) |

Handle the preparation part of the forking process.

Definition at line 40 of file XrdClForkHandler.cc.

{
Log *log = DefaultEnv::GetLog();
pid_t pid = getpid();
log->Debug( UtilityMsg, "Running the prepare fork handler for process %d",
pid );
pMutex.Lock();
if( pPostMaster )
pPostMaster->Stop();
pFileTimer->Lock();
//--------------------------------------------------------------------------
// Lock the user-level objects
//--------------------------------------------------------------------------
log->Debug( UtilityMsg, "Locking File and FileSystem objects for process: "
"%d", pid );
std::set<FileStateHandler*>::iterator itFile;
for( itFile = pFileObjects.begin(); itFile != pFileObjects.end();
++itFile )
(*itFile)->Lock();
std::set<FileSystem*>::iterator itFs;
for( itFs = pFileSystemObjects.begin(); itFs != pFileSystemObjects.end();
++itFs )
(*itFs)->Lock();
}

References XrdCl::Log::Debug(), XrdCl::DefaultEnv::GetLog(), and XrdCl::UtilityMsg.

Referenced by prepare().

Here is the call graph for this function:
Here is the caller graph for this function:

## RegisterFileObject()

void XrdCl::ForkHandler::RegisterFileObject | ( | FileStateHandler * | file | ) |

inline

Register a file object.

Definition at line 43 of file XrdClForkHandler.hh.

{
XrdSysMutexHelper scopedLock( pMutex );
pFileObjects.insert( file );
}

Referenced by XrdCl::FileStateHandler::FileStateHandler(), and XrdCl::FileStateHandler::FileStateHandler().

Here is the caller graph for this function:

## RegisterFileSystemObject()

void XrdCl::ForkHandler::RegisterFileSystemObject | ( | FileSystem * | fs | ) |

inline

Definition at line 61 of file XrdClForkHandler.hh.

{
XrdSysMutexHelper scopedLock( pMutex );
pFileSystemObjects.insert( fs );
}

## RegisterFileTimer()

void XrdCl::ForkHandler::RegisterFileTimer | ( | FileTimer * | fileTimer | ) |

inline

Definition at line 85 of file XrdClForkHandler.hh.

{
XrdSysMutexHelper scopedLock( pMutex );
pFileTimer = fileTimer;
}

## RegisterPostMaster()

void XrdCl::ForkHandler::RegisterPostMaster | ( | PostMaster * | postMaster | ) |

inline

Register a post master object.

Definition at line 79 of file XrdClForkHandler.hh.

{
XrdSysMutexHelper scopedLock( pMutex );
pPostMaster = postMaster;
}

## UnRegisterFileObject()

void XrdCl::ForkHandler::UnRegisterFileObject | ( | FileStateHandler * | file | ) |

inline

Definition at line 52 of file XrdClForkHandler.hh.

{
XrdSysMutexHelper scopedLock( pMutex );
pFileObjects.erase( file );
}

Referenced by XrdCl::FileStateHandler::~FileStateHandler().

Here is the caller graph for this function:

## UnRegisterFileSystemObject()

void XrdCl::ForkHandler::UnRegisterFileSystemObject | ( | FileSystem * | fs | ) |

inline

Un-register a file system object.

Definition at line 70 of file XrdClForkHandler.hh.

{
XrdSysMutexHelper scopedLock( pMutex );
pFileSystemObjects.erase( fs );
}

Referenced by XrdCl::FileSystem::~FileSystem().

Here is the caller graph for this function:

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

- XrdClForkHandler.hh
- XrdClForkHandler.cc