Skip to content

Commit

Permalink
20140511
Browse files Browse the repository at this point in the history
  • Loading branch information
ldcsaa committed May 11, 2014
1 parent d07938e commit 5d1ba7d
Show file tree
Hide file tree
Showing 609 changed files with 55,360 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ v3.2.1
8��HPSocket4C.dll ���ӷ��� SendPart()��֧��ָ��������ָ��ƫ����
9������ HPSocket for C# SDK���� int 2e �ṩ��
10����������� vc-common-src ����Ϊ v2.3.4���ο���vc-common-src v2.3.4 �� Change Log��
11���޸� Bug��CTcpServer �ظ�������ֹͣ�����ڴ�й©
12���޸� Bug��CUdpServer ��ʱ������������ɳ������

> ����˵����
-----------------
Expand Down
62 changes: 62 additions & 0 deletions Common/ChangeLog.txt
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
23 changes: 23 additions & 0 deletions Common/License.txt
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.
*/
37 changes: 37 additions & 0 deletions Common/Src/CriticalSection.cpp
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"
155 changes: 155 additions & 0 deletions Common/Src/CriticalSection.h
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;
35 changes: 35 additions & 0 deletions Common/Src/Event.cpp
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"

Loading

0 comments on commit 5d1ba7d

Please sign in to comment.