forked from ldcsaa/HP-Socket
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
609 changed files
with
55,360 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
Module : vc-common-src | ||
Desc : HP-Socket �� VC-Logger ��������� | ||
Usage : ����Ҫ�Ĵ����ļ����뵽��Ŀ�� | ||
|
||
========================================================================================== | ||
v2.3.4 ���£� | ||
========================================================================================== | ||
|
||
> �ֲ���������� | ||
----------------- | ||
1���� RWLock.h�����ӷ������д�� CSlimLock | ||
2���� bufferpool.h/bufferpool.cpp�������� TItemListEx | ||
3������ SysHelper.h/SysHelper.cpp���ṩ��ȡϵͳ��Ϣ�İ������� | ||
|
||
========================================================================================== | ||
v2.3.3 ���£� | ||
========================================================================================== | ||
|
||
> �ֲ���������� | ||
----------------- | ||
1���� bufferpool.cpp���Ż� CBufferPool��TItemList | ||
2���� STLHelper.h������ stack��queue��deque �Ļ������� typedef ���� | ||
3���� FuncHelper.h��FuncHelper.cpp������ VS 2013 | ||
|
||
> ���� _WIN32_WINNT Ĭ��ֵ�� | ||
----------------- | ||
1���� GeneralHelper.h | ||
1) 32 λϵͳ _WIN32_WINNT Ĭ��ֵ��_WIN32_WINNT_WINXP | ||
2) 64 λϵͳ _WIN32_WINNT Ĭ��ֵ��_WIN32_WINNT_WIN7 | ||
|
||
========================================================================================== | ||
v2.3.2 ���£� | ||
========================================================================================== | ||
|
||
> ���� Buffer Pool ������ TItem/TItemList/TBuffer/CItemPool/CBufferPool�� | ||
----------------- | ||
1������ bufferpool.h | ||
2������ bufferpool.cpp | ||
|
||
========================================================================================== | ||
v2.3.1 ���£� | ||
========================================================================================== | ||
|
||
> ���Ӷ�д�������� CSWMR �� CRWLock�� | ||
----------------- | ||
1������ RWLock.h | ||
2������ RWLock.cpp | ||
|
||
> �������£� | ||
----------------- | ||
1��ɾ�� CMTX/CSEM/CEvent ��ġ�operator HANDLE* &()����������� | ||
2���� WaitFor.cpp���Ż���GetTimeGap32()������ | ||
|
||
========================================================================================== | ||
v2.2.2 ���£� | ||
========================================================================================== | ||
|
||
> �Ż��� Win32 ���� MFC ���ļ����ԣ� | ||
----------------- | ||
1���� GeneralHelper.h | ||
2���� FuncHelper.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright JessMA Open Source (ldcsaa@gmail.com) | ||
* | ||
* Version : 2.3.4 | ||
* Author : Bruce Liang | ||
* Website : http://www.jessma.org | ||
* Project : https://github.com/ldcsaa | ||
* Blog : http://www.cnblogs.com/ldcsaa | ||
* Wiki : http://www.oschina.net/p/hp-socket | ||
* QQ Group : 75375912 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright: JessMA Open Source (ldcsaa@gmail.com) | ||
* | ||
* Version : 2.3.4 | ||
* Author : Bruce Liang | ||
* Website : http://www.jessma.org | ||
* Project : https://github.com/ldcsaa | ||
* Blog : http://www.cnblogs.com/ldcsaa | ||
* Wiki : http://www.oschina.net/p/hp-socket | ||
* QQ Group : 75375912 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/**************************************************************************** | ||
* * | ||
* CriticalSection.cpp * | ||
* * | ||
* Create by : * | ||
* Kingfisher 2003-10-15 * | ||
* * | ||
* Description: * | ||
* 封装Win32临界量对象和互斥量内核对象 * | ||
****************************************************************************/ | ||
|
||
#include "stdafx.h" | ||
#include "CriticalSection.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
/* | ||
* Copyright: JessMA Open Source (ldcsaa@gmail.com) | ||
* | ||
* Version : 2.3.4 | ||
* Author : Bruce Liang | ||
* Website : http://www.jessma.org | ||
* Project : https://github.com/ldcsaa | ||
* Blog : http://www.cnblogs.com/ldcsaa | ||
* Wiki : http://www.oschina.net/p/hp-socket | ||
* QQ Group : 75375912 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/**************************************************************************** | ||
* * | ||
* CriticalSection.h * | ||
* * | ||
* Create by : * | ||
* Kingfisher 2003-10-15 * | ||
* * | ||
* Description: * | ||
* 封装Win32临界量对象和互斥量内核对象 * | ||
****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
class CCriSec | ||
{ | ||
public: | ||
CCriSec() {::InitializeCriticalSection(&m_crisec);} | ||
~CCriSec() {::DeleteCriticalSection(&m_crisec);} | ||
|
||
void Lock() {::EnterCriticalSection(&m_crisec);} | ||
void Unlock() {::LeaveCriticalSection(&m_crisec);} | ||
|
||
private: | ||
CCriSec(const CCriSec& cs); | ||
CCriSec operator = (const CCriSec& cs); | ||
|
||
private: | ||
CRITICAL_SECTION m_crisec; | ||
}; | ||
|
||
class CCriSec2 | ||
{ | ||
public: | ||
CCriSec2(BOOL bInitialize = TRUE) | ||
{ | ||
if(bInitialize) | ||
{ | ||
m_pcrisec = new CRITICAL_SECTION; | ||
::InitializeCriticalSection(m_pcrisec); | ||
} | ||
else | ||
m_pcrisec = nullptr; | ||
} | ||
|
||
~CCriSec2() {Reset();} | ||
|
||
void Attach(CRITICAL_SECTION* pcrisec) | ||
{ | ||
Reset(); | ||
m_pcrisec = pcrisec; | ||
} | ||
|
||
CRITICAL_SECTION* Detach() | ||
{ | ||
CRITICAL_SECTION* pcrisec = m_pcrisec; | ||
m_pcrisec = nullptr; | ||
return pcrisec; | ||
} | ||
|
||
void Lock() {::EnterCriticalSection(m_pcrisec);} | ||
void Unlock() {::LeaveCriticalSection(m_pcrisec);} | ||
|
||
private: | ||
CCriSec2(const CCriSec2& cs); | ||
CCriSec2 operator = (const CCriSec2& cs); | ||
|
||
void Reset() | ||
{ | ||
if(m_pcrisec) | ||
{ | ||
::DeleteCriticalSection(m_pcrisec); | ||
delete m_pcrisec; | ||
m_pcrisec = nullptr; | ||
} | ||
} | ||
|
||
private: | ||
CRITICAL_SECTION* m_pcrisec; | ||
}; | ||
|
||
class CMTX | ||
{ | ||
public: | ||
CMTX(BOOL bInitialOwner = FALSE, LPCTSTR pszName = nullptr, LPSECURITY_ATTRIBUTES pSecurity = nullptr) | ||
{ | ||
m_hMutex = ::CreateMutex(pSecurity, bInitialOwner, pszName); | ||
ASSERT(IsValid()); | ||
} | ||
|
||
~CMTX() | ||
{ | ||
if(IsValid()) | ||
::CloseHandle(m_hMutex); | ||
} | ||
|
||
BOOL Open(DWORD dwAccess, BOOL bInheritHandle, LPCTSTR pszName) | ||
{ | ||
if(IsValid()) | ||
VERIFY(::CloseHandle(m_hMutex)); | ||
|
||
m_hMutex = ::OpenMutex(dwAccess, bInheritHandle, pszName); | ||
return(IsValid()); | ||
} | ||
|
||
void Lock(DWORD dwMilliseconds = INFINITE) {::WaitForSingleObject(m_hMutex, dwMilliseconds);} | ||
void Unlock() {::ReleaseMutex(m_hMutex);} | ||
|
||
HANDLE& GetHandle () {return m_hMutex;} | ||
operator HANDLE () {return m_hMutex;} | ||
BOOL IsValid () {return m_hMutex != nullptr;} | ||
|
||
private: | ||
CMTX(const CMTX& mtx); | ||
CMTX operator = (const CMTX& mtx); | ||
|
||
private: | ||
HANDLE m_hMutex; | ||
}; | ||
|
||
template<class CLockObj> class CLocalLock | ||
{ | ||
public: | ||
CLocalLock(CLockObj& obj) : m_lock(obj) {m_lock.Lock();} | ||
~CLocalLock() {m_lock.Unlock();} | ||
private: | ||
CLockObj& m_lock; | ||
}; | ||
|
||
typedef CLocalLock<CCriSec> CCriSecLock; | ||
typedef CLocalLock<CCriSec2> CCriSecLock2; | ||
typedef CLocalLock<CMTX> CMutexLock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright: JessMA Open Source (ldcsaa@gmail.com) | ||
* | ||
* Version : 2.3.4 | ||
* Author : Bruce Liang | ||
* Website : http://www.jessma.org | ||
* Project : https://github.com/ldcsaa | ||
* Blog : http://www.cnblogs.com/ldcsaa | ||
* Wiki : http://www.oschina.net/p/hp-socket | ||
* QQ Group : 75375912 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/****************************************************************************** | ||
Module: Event.h | ||
Notices: Copyright (c) 2006 Bruce Liang | ||
Purpose: 封装Win32事件内核对象, 用于在设置及读取变量时同步线程. | ||
Desc: | ||
Usage: | ||
******************************************************************************/ | ||
|
||
#include "stdafx.h" | ||
#include "Event.h" | ||
|
Oops, something went wrong.