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 111 of file ProcessDescriptor.h.

Constructor & Destructor Documentation

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

Definition at line 400 of file ProcessDescriptor.cpp.

400  {
401  if ( pid > 0 ) {
402  if ( pid != s_myPid ) {
403 #ifdef _WIN32
404  m_handle = ::OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE,
405  pid);
406 #else
407  // Note: the return type of getpid is pid_t, which is int on 64bit machines too
408  m_handle = reinterpret_cast<void*>(static_cast<long>(s_myPid));
409 #endif
410  m_needRelease = true;
411  return;
412  }
413  }
415  m_needRelease = false;
416 }
GAUDI_API ProcessHandle processHandle()
Handle to running process.
Definition: ModuleInfo.cpp:127
#define s_myPid
System::ProcessDescriptor::ProcessHandle::~ProcessHandle ( )
virtual

Definition at line 418 of file ProcessDescriptor.cpp.

418  {
419  if ( m_needRelease ) {
420 #ifdef _WIN32
421  ::CloseHandle(m_handle);
422 #else
423  m_handle = 0;
424 #endif
425  }
426 }

Member Function Documentation

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

Definition at line 120 of file ProcessDescriptor.h.

120  {
121  return m_handle;
122  }
long System::ProcessDescriptor::ProcessHandle::item ( )
inline

Definition at line 117 of file ProcessDescriptor.h.

117  {
118  return m_needRelease ? 1 : 0;
119  }

Member Data Documentation

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

Definition at line 112 of file ProcessDescriptor.h.

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

Definition at line 113 of file ProcessDescriptor.h.


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