| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Private Attributes | List of all members
System::ProcessDescriptor::ProcessHandle Class Reference

## Public Member Functions
| ProcessHandle (long pid)
virtual | ~ProcessHandle ()
long | item ()
void * | handle ()

## Private Attributes
void * | m_handle
bool | m_needRelease

## Detailed Description

Definition at line 109 of file ProcessDescriptor.h.

## Constructor & Destructor Documentation

## ◆ ProcessHandle()

System::ProcessDescriptor::ProcessHandle::ProcessHandle | ( | long | pid | ) |

Definition at line 353 of file ProcessDescriptor.cpp.

353 {
354 if ( pid > 0 ) {
355 if ( pid != ::getpid() ) {
356 #ifdef _WIN32
357 m_handle = ::OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid );
358 #else
359 // Note: the return type of getpid is pid_t, which is int on 64bit machines too
360 m_handle = reinterpret_cast<void*>( static_cast<long>( ::getpid() ) );
361 #endif
362 m_needRelease = true;
363 return;
364 }
365 }
366 m_handle = processHandle();
367 m_needRelease = false;
368 }
System::processHandle
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:125
GaudiKernel.Constants.FALSE
bool FALSE
Definition: Constants.py:21
System::ProcessDescriptor::ProcessHandle::m_needRelease
bool m_needRelease
Definition: ProcessDescriptor.h:111
System::ProcessDescriptor::ProcessHandle::m_handle
void * m_handle
Definition: ProcessDescriptor.h:110

## ◆ ~ProcessHandle()

System::ProcessDescriptor::ProcessHandle::~ProcessHandle | ( |  | ) |
| virtual

Definition at line 370 of file ProcessDescriptor.cpp.

370 {
371 if ( m_needRelease ) {
372 #ifdef _WIN32
373 ::CloseHandle( m_handle );
374 #else
375 m_handle = nullptr;
376 #endif
377 }
378 }
System::ProcessDescriptor::ProcessHandle::m_needRelease
bool m_needRelease
Definition: ProcessDescriptor.h:111
System::ProcessDescriptor::ProcessHandle::m_handle
void * m_handle
Definition: ProcessDescriptor.h:110

## Member Function Documentation

## ◆ handle()

void* System::ProcessDescriptor::ProcessHandle::handle | ( |  | ) |
| inline

Definition at line 117 of file ProcessDescriptor.h.

117 { return m_handle; }
System::ProcessDescriptor::ProcessHandle::m_handle
void * m_handle
Definition: ProcessDescriptor.h:110

## ◆ item()

long System::ProcessDescriptor::ProcessHandle::item | ( |  | ) |
| inline

Definition at line 116 of file ProcessDescriptor.h.

116 { return m_needRelease ? 1 : 0; }
System::ProcessDescriptor::ProcessHandle::m_needRelease
bool m_needRelease
Definition: ProcessDescriptor.h:111

## Member Data Documentation

## ◆ m_handle

void* System::ProcessDescriptor::ProcessHandle::m_handle
| private

Definition at line 110 of file ProcessDescriptor.h.

## ◆ m_needRelease

bool System::ProcessDescriptor::ProcessHandle::m_needRelease
| private

Definition at line 111 of file ProcessDescriptor.h.

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

- GaudiKernel/src/Lib/ProcessDescriptor.h
- GaudiKernel/src/Lib/ProcessDescriptor.cpp