This commit is contained in:
luoliangyi 2022-07-27 09:18:52 +08:00
parent 9fb87cd924
commit 4bce95ac8d
1 changed files with 20 additions and 4 deletions

View File

@ -28,8 +28,11 @@ struct HGNamedPipeOutImpl
CloseHandle(m_hConnectEvent); CloseHandle(m_hConnectEvent);
m_hConnectEvent = NULL; m_hConnectEvent = NULL;
#else #else
close(m_fdPipe); if (-1 != m_fdPipe)
m_fdPipe = -1; {
close(m_fdPipe);
m_fdPipe = -1;
}
unlink(m_filePath.c_str()); unlink(m_filePath.c_str());
#endif #endif
} }
@ -65,8 +68,11 @@ struct HGNamedPipeInImpl
CloseHandle(m_hReadEvent); CloseHandle(m_hReadEvent);
m_hReadEvent = NULL; m_hReadEvent = NULL;
#else #else
close(m_fdPipe); if (-1 != m_fdPipe)
m_fdPipe = -1; {
close(m_fdPipe);
m_fdPipe = -1;
}
#endif #endif
} }
@ -221,6 +227,11 @@ HGResult HGAPI HGBase_StopWriteNamedPipe(HGNamedPipeOut pipeOut)
SetEvent(pipeOutImpl->m_hConnectEvent); SetEvent(pipeOutImpl->m_hConnectEvent);
SetEvent(pipeOutImpl->m_hWriteEvent); SetEvent(pipeOutImpl->m_hWriteEvent);
#else #else
if (-1 != pipeInImpl->m_fdPipe)
{
close(pipeInImpl->m_fdPipe);
pipeInImpl->m_fdPipe = -1;
}
#endif #endif
return HGBASE_ERR_OK; return HGBASE_ERR_OK;
} }
@ -333,6 +344,11 @@ HGResult HGAPI HGBase_StopReadNamedPipe(HGNamedPipeIn pipeIn)
#if defined(HG_CMP_MSC) #if defined(HG_CMP_MSC)
SetEvent(pipeInImpl->m_hReadEvent); SetEvent(pipeInImpl->m_hReadEvent);
#else #else
if (-1 != pipeInImpl->m_fdPipe)
{
close(pipeInImpl->m_fdPipe);
pipeInImpl->m_fdPipe = -1;
}
#endif #endif
return HGBASE_ERR_OK; return HGBASE_ERR_OK;
} }