mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2024-12-22 22:16:38 +08:00
修复TC_Shm类,先detch后无法del的问题
This commit is contained in:
parent
f0c6e5a651
commit
2070c97dc1
@ -68,7 +68,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param bOwner 是否拥有共享内存,默认为false
|
* @param bOwner 是否拥有共享内存,默认为false
|
||||||
*/
|
*/
|
||||||
TC_Shm(bool bOwner = false) : _bOwner(bOwner),_shmSize(0),_shmKey(0),_bCreate(true), _pshm(NULL) {}
|
TC_Shm(bool bOwner = false) : _bOwner(bOwner),_shmSize(0),_shmKey(0),_bCreate(true), _pshm(NULL), _shemID(0) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 构造函数.
|
* @brief 构造函数.
|
||||||
@ -181,4 +181,4 @@ protected:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -120,11 +120,11 @@ int TC_Shm::del()
|
|||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
int iRetCode = 0;
|
int iRetCode = 0;
|
||||||
if (_pshm != NULL)
|
if (_shemID > 0)
|
||||||
{
|
{
|
||||||
iRetCode = shmctl(_shemID, IPC_RMID, 0);
|
iRetCode = shmctl(_shemID, IPC_RMID, 0);
|
||||||
|
|
||||||
_pshm = NULL;
|
_shemID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return iRetCode;
|
return iRetCode;
|
||||||
|
Loading…
Reference in New Issue
Block a user