#include <WinSMTool.h>
Public Member Functions | |
CWinSharedMemory (void) | |
CWinSharedMemory (const char *name) | |
CWinSharedMemory (const char *name, int size=1024, BOOL create=FALSE) | |
virtual | ~CWinSharedMemory (void) |
Protected Member Functions | |
void | createMap () |
void | get () |
void | put () |
Protected Attributes | |
HANDLE | m_hMapping = NULL |
void * | m_pMappingView = NULL |
CMutex * | m_pMutex = NULL |
Definition at line 18 of file WinSMTool.h.
CWinSharedMemory | ( | void | ) |
Definition at line 9 of file WinSMTool.cpp.
References JBXWL_DEFAULT_SMNAME.
00010 { 00011 CWinSharedMemory(JBXWL_DEFAULT_SMNAME, 1024, FALSE); 00012 }
CWinSharedMemory | ( | const char * | name | ) |
CWinSharedMemory | ( | const char * | name, | |
int | size = 1024 , |
|||
BOOL | create = FALSE | |||
) |
Definition at line 16 of file WinSMTool.cpp.
References CWinSharedMemory::m_hMapping, CWinSharedMemory::m_pMappingView, CWinSharedMemory::m_pMutex, and jbxwl::mbs2ts().
00017 { 00018 m_hMapping = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, mbs2ts((char*)name)); 00019 00020 if (m_hMapping == NULL && create) { 00021 // メモリマップドファイルの生成 00022 m_hMapping = ::CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, size, mbs2ts((char*)name)); 00023 } 00024 00025 if (m_hMapping != NULL) { 00026 // プロセス内のアドレス空間にファイルのビューをマップ 00027 m_pMappingView = ::MapViewOfFile(m_hMapping, FILE_MAP_ALL_ACCESS, 0, 0, size); 00028 00029 // ミューテックスオブジェクトの生成 00030 m_pMutex = new CMutex(FALSE, mbs2ts((char*)name)+mbs2ts("_mutex")); 00031 } 00032 }
~CWinSharedMemory | ( | void | ) | [virtual] |
Definition at line 36 of file WinSMTool.cpp.
References CWinSharedMemory::m_hMapping, CWinSharedMemory::m_pMappingView, and CWinSharedMemory::m_pMutex.
00037 { 00038 BOOL b = ::UnmapViewOfFile(m_pMappingView); 00039 ::CloseHandle(m_hMapping); 00040 00041 delete m_pMutex; 00042 }
void createMap | ( | ) | [protected] |
void get | ( | ) | [protected] |
Definition at line 54 of file WinSMTool.cpp.
References CWinSharedMemory::m_pMutex.
void put | ( | ) | [protected] |
Definition at line 66 of file WinSMTool.cpp.
References CWinSharedMemory::m_pMutex.
HANDLE m_hMapping = NULL [protected] |
Definition at line 28 of file WinSMTool.h.
Referenced by CWinSharedMemory::CWinSharedMemory(), and CWinSharedMemory::~CWinSharedMemory().
void* m_pMappingView = NULL [protected] |
Definition at line 29 of file WinSMTool.h.
Referenced by CWinSharedMemory::CWinSharedMemory(), and CWinSharedMemory::~CWinSharedMemory().
CMutex* m_pMutex = NULL [protected] |
Definition at line 30 of file WinSMTool.h.
Referenced by CWinSharedMemory::CWinSharedMemory(), CWinSharedMemory::get(), CWinSharedMemory::put(), and CWinSharedMemory::~CWinSharedMemory().