commit 2025-09-04 14:13 add ZCppMain/ZCProcess.H & ZCppMainTest/ZtCThreadEx_000.cpp
This commit is contained in:
1556
ZCppMain/ZCProcess.H
Normal file
1556
ZCppMain/ZCProcess.H
Normal file
File diff suppressed because it is too large
Load Diff
4678
ZCppMain/ZCProcess_Linux.H
Normal file
4678
ZCppMain/ZCProcess_Linux.H
Normal file
File diff suppressed because it is too large
Load Diff
3151
ZCppMain/ZCProcess_Win.H
Normal file
3151
ZCppMain/ZCProcess_Win.H
Normal file
File diff suppressed because it is too large
Load Diff
@ -113,7 +113,7 @@ namespace ZNsMain
|
|||||||
TypeLength VL_NeedSize = VL_ThisSize +
|
TypeLength VL_NeedSize = VL_ThisSize +
|
||||||
(AL_Replace-AL_Searched) * VL_PosListSize ;
|
(AL_Replace-AL_Searched) * VL_PosListSize ;
|
||||||
|
|
||||||
TypePChar VPC_ThisStart = this->data() ;
|
TypePChar VPC_ThisStart = const_cast<char*>(this->data()) ;
|
||||||
IterEasyID VH_IterEasyID = AR_CPosList.ItHID();
|
IterEasyID VH_IterEasyID = AR_CPosList.ItHID();
|
||||||
TypeLength VL_SearchedPos= 0 ;
|
TypeLength VL_SearchedPos= 0 ;
|
||||||
TypeLength VL_SearchedPre= 0 ; // VL_SearchedPos 의 이전 값
|
TypeLength VL_SearchedPre= 0 ; // VL_SearchedPos 의 이전 값
|
||||||
@ -179,7 +179,7 @@ namespace ZNsMain
|
|||||||
|
|
||||||
ARR_SaveOut.resize(VL_NeedSize);
|
ARR_SaveOut.resize(VL_NeedSize);
|
||||||
|
|
||||||
TypePChar VPC_OutStart = ARR_SaveOut.data() ;
|
TypePChar VPC_OutStart = const_cast<char*>(ARR_SaveOut.data()) ;
|
||||||
TypePChar VPC_CopyStart = 0 ;
|
TypePChar VPC_CopyStart = 0 ;
|
||||||
TypePChar VPC_DestStart = 0 ;
|
TypePChar VPC_DestStart = 0 ;
|
||||||
TypeLength VL_CopyStart = 0 ;
|
TypeLength VL_CopyStart = 0 ;
|
||||||
|
@ -2671,15 +2671,15 @@ namespace ZNsMain
|
|||||||
|
|
||||||
template< typename TType, typename TypeArg=const TType&
|
template< typename TType, typename TypeArg=const TType&
|
||||||
>
|
>
|
||||||
class ZtCExceptBase_T /*///////////////////////////////*/
|
class ZtCExceptBase /*/////////////////////////////////*/
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
TType mo_Type;
|
TType mo_Type;
|
||||||
public :
|
public :
|
||||||
|
|
||||||
ZtCExceptBase_T(){}
|
ZtCExceptBase(){}
|
||||||
|
|
||||||
ZtCExceptBase_T(TypeArg TypeArgObj):mo_Type(TypeArgObj){}
|
ZtCExceptBase(TypeArg TypeArgObj):mo_Type(TypeArgObj){}
|
||||||
|
|
||||||
TType& operator()(){return mo_Type;}
|
TType& operator()(){return mo_Type;}
|
||||||
|
|
||||||
@ -2687,7 +2687,7 @@ namespace ZNsMain
|
|||||||
};/*
|
};/*
|
||||||
template< typename TType, typename TypeArg=const TType&
|
template< typename TType, typename TypeArg=const TType&
|
||||||
>
|
>
|
||||||
class ZtCExceptBase_T /////////////////////////////////*/
|
class ZtCExceptBase ///////////////////////////////////*/
|
||||||
|
|
||||||
|
|
||||||
/*/////////////////////////////////////////////////////////////////////////////////
|
/*/////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -2705,16 +2705,16 @@ namespace ZNsMain
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////*/
|
/////////////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
class CNonCopyable
|
class ZCNonCopyable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CNonCopyable(const CNonCopyable& rhs){}
|
ZCNonCopyable(const ZCNonCopyable& rhs){}
|
||||||
CNonCopyable& operator=(const CNonCopyable& rhs){return *this;}
|
ZCNonCopyable& operator=(const ZCNonCopyable& rhs){return *this;}
|
||||||
public :
|
public :
|
||||||
CNonCopyable(){}
|
ZCNonCopyable(){}
|
||||||
public :
|
public :
|
||||||
};/*
|
};/*
|
||||||
class CNonCopyable*/
|
class ZCNonCopyable*/
|
||||||
|
|
||||||
|
|
||||||
/*///////////////////////////////////////////////////////////////////////////
|
/*///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1713,7 +1713,10 @@ namespace ZNsMain
|
|||||||
|
|
||||||
ZCStdTime(const ZCStdTime& rhs)
|
ZCStdTime(const ZCStdTime& rhs)
|
||||||
{
|
{
|
||||||
if(this==&rhs) return;
|
if(this==&rhs)
|
||||||
|
{
|
||||||
|
mb_IsLocal = true; return;
|
||||||
|
}
|
||||||
|
|
||||||
mb_IsLocal =rhs.mb_IsLocal ;
|
mb_IsLocal =rhs.mb_IsLocal ;
|
||||||
mo_FILETIME =rhs.mo_FILETIME ;
|
mo_FILETIME =rhs.mo_FILETIME ;
|
||||||
|
@ -234,7 +234,7 @@ namespace ZNsMain
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef _REENTRANT_MUTEX
|
#ifdef _REENTRANT_MUTEX
|
||||||
ZNsMain::CMutexSmallInit mo_Mutex ;
|
ZNsMain::ZCMutexSmallInit mo_Mutex ;
|
||||||
#endif //_REENTRANT_MUTEX
|
#endif //_REENTRANT_MUTEX
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -253,7 +253,7 @@ namespace ZNsMain
|
|||||||
ZCLink* GetOneLink()
|
ZCLink* GetOneLink()
|
||||||
{
|
{
|
||||||
#ifdef _REENTRANT_MUTEX
|
#ifdef _REENTRANT_MUTEX
|
||||||
ZNsMain::CMutexSmallLock VO_CMutexSmallLock(mo_Mutex);
|
ZNsMain::ZCMutexSmallLock VO_ZCMutexSmallLock(mo_Mutex);
|
||||||
#endif //_REENTRANT_MUTEX
|
#endif //_REENTRANT_MUTEX
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@ -288,7 +288,7 @@ namespace ZNsMain
|
|||||||
/*************/ )
|
/*************/ )
|
||||||
{
|
{
|
||||||
#ifdef _REENTRANT_MUTEX
|
#ifdef _REENTRANT_MUTEX
|
||||||
ZNsMain::CMutexSmallLock VO_CMutexSmallLock(mo_Mutex);
|
ZNsMain::ZCMutexSmallLock VO_ZCMutexSmallLock(mo_Mutex);
|
||||||
#endif //_REENTRANT_MUTEX
|
#endif //_REENTRANT_MUTEX
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@ -397,7 +397,7 @@ namespace ZNsMain
|
|||||||
// 기존에 있는 ml_UseSize 개의 링크를 먼저 사용한다.
|
// 기존에 있는 ml_UseSize 개의 링크를 먼저 사용한다.
|
||||||
|
|
||||||
#ifdef _REENTRANT_MUTEX
|
#ifdef _REENTRANT_MUTEX
|
||||||
ZNsMain::CMutexSmallLock VO_CMutexSmallLock(mo_Mutex);
|
ZNsMain::ZCMutexSmallLock VO_ZCMutexSmallLock(mo_Mutex);
|
||||||
#endif //_REENTRANT_MUTEX
|
#endif //_REENTRANT_MUTEX
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@ -479,7 +479,7 @@ namespace ZNsMain
|
|||||||
/**********/ )
|
/**********/ )
|
||||||
{
|
{
|
||||||
#ifdef _REENTRANT_MUTEX
|
#ifdef _REENTRANT_MUTEX
|
||||||
ZNsMain::CMutexSmallLock VO_CMutexSmallLock(mo_Mutex);
|
ZNsMain::ZCMutexSmallLock VO_ZCMutexSmallLock(mo_Mutex);
|
||||||
#endif //_REENTRANT_MUTEX
|
#endif //_REENTRANT_MUTEX
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@ -577,7 +577,7 @@ namespace ZNsMain
|
|||||||
|
|
||||||
|
|
||||||
#ifdef _REENTRANT_MUTEX
|
#ifdef _REENTRANT_MUTEX
|
||||||
ZNsMain::CMutexSmallLock VO_CMutexSmallLock(mo_Mutex);
|
ZNsMain::ZCMutexSmallLock VO_ZCMutexSmallLock(mo_Mutex);
|
||||||
#endif //_REENTRANT_MUTEX
|
#endif //_REENTRANT_MUTEX
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@ -658,7 +658,7 @@ namespace ZNsMain
|
|||||||
void ReceiveLink(ZCLink* AP_Link)
|
void ReceiveLink(ZCLink* AP_Link)
|
||||||
{
|
{
|
||||||
#ifdef _REENTRANT_MUTEX
|
#ifdef _REENTRANT_MUTEX
|
||||||
ZNsMain::CMutexSmallLock VO_CMutexSmallLock(mo_Mutex);
|
ZNsMain::ZCMutexSmallLock VO_ZCMutexSmallLock(mo_Mutex);
|
||||||
#endif //_REENTRANT_MUTEX
|
#endif //_REENTRANT_MUTEX
|
||||||
|
|
||||||
AP_Link->mp_NextLink=0;
|
AP_Link->mp_NextLink=0;
|
||||||
@ -682,7 +682,7 @@ namespace ZNsMain
|
|||||||
void ReceiveLink(ZCLink* AP_HeadLink,ZCLink* AP_TailLink,TTypSize AL_Count)
|
void ReceiveLink(ZCLink* AP_HeadLink,ZCLink* AP_TailLink,TTypSize AL_Count)
|
||||||
{
|
{
|
||||||
#ifdef _REENTRANT_MUTEX
|
#ifdef _REENTRANT_MUTEX
|
||||||
ZNsMain::CMutexSmallLock VO_CMutexSmallLock(mo_Mutex);
|
ZNsMain::ZCMutexSmallLock VO_ZCMutexSmallLock(mo_Mutex);
|
||||||
#endif //_REENTRANT_MUTEX
|
#endif //_REENTRANT_MUTEX
|
||||||
|
|
||||||
if(ml_UseSize==0)
|
if(ml_UseSize==0)
|
||||||
@ -771,7 +771,7 @@ namespace ZNsMain
|
|||||||
void DeleteAllInHeap()
|
void DeleteAllInHeap()
|
||||||
{
|
{
|
||||||
#ifdef _REENTRANT_MUTEX
|
#ifdef _REENTRANT_MUTEX
|
||||||
ZNsMain::CMutexSmallLock VO_CMutexSmallLock(mo_Mutex);
|
ZNsMain::ZCMutexSmallLock VO_ZCMutexSmallLock(mo_Mutex);
|
||||||
#endif //_REENTRANT_MUTEX
|
#endif //_REENTRANT_MUTEX
|
||||||
|
|
||||||
if(ml_UseSize==0)
|
if(ml_UseSize==0)
|
||||||
|
170
ZCppMainTest/ZtCThreadEx_000.cpp
Normal file
170
ZCppMainTest/ZtCThreadEx_000.cpp
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#ifndef _REENTRANT_EX
|
||||||
|
#define _REENTRANT_EX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include "ZCppMain/ZCStringStd.H"
|
||||||
|
#include "ZCppMain/ZCProcess.H"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std ;
|
||||||
|
using namespace ZNsMain;
|
||||||
|
|
||||||
|
|
||||||
|
namespace ZNsMain
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace ZNsExam
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename TDummy=void*> class ZtCExamThread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
class CThreadMy : public ZNsMain::ZtCThreadEx<CThreadMy>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
void Init(ZCStringStd& AR_KeyCStr)
|
||||||
|
{
|
||||||
|
cout<<"# Init() : "<<AR_KeyCStr<<endl;
|
||||||
|
}
|
||||||
|
void Exec(ZCStringStd& AR_KeyCStr)
|
||||||
|
{
|
||||||
|
cout<<"# Exec() : "<<AR_KeyCStr<<endl;
|
||||||
|
}
|
||||||
|
void Fini(ZCStringStd& AR_KeyCStr)
|
||||||
|
{
|
||||||
|
cout<<"# Fini() : "<<AR_KeyCStr<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Init(ZCStringStd& AR_KeyCStr, ZCStringStd& AR_KeyCStr2)
|
||||||
|
{
|
||||||
|
cout<<"# Init2() : "<<AR_KeyCStr2<<endl;
|
||||||
|
}
|
||||||
|
void Exec(ZCStringStd& AR_KeyCStr, ZCStringStd& AR_KeyCStr2)
|
||||||
|
{
|
||||||
|
cout<<"# Init2() : "<<AR_KeyCStr2<<endl;
|
||||||
|
}
|
||||||
|
void Fini(ZCStringStd& AR_KeyCStr, ZCStringStd& AR_KeyCStr2)
|
||||||
|
{
|
||||||
|
cout<<"# Init2() : "<<AR_KeyCStr2<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
};/*
|
||||||
|
class CThreadMy : public ZNsMain::ZtCThreadEx<CThreadMy>*/
|
||||||
|
|
||||||
|
|
||||||
|
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||||
|
{
|
||||||
|
CThreadMy VO_CThreadMy ;
|
||||||
|
ZCStringStd VO_ZCStringStd1("Help Data1");
|
||||||
|
ZCStringStd VO_ZCStringStd2("Help Data2");
|
||||||
|
|
||||||
|
VO_CThreadMy.Make(ZftMCP(VO_ZCStringStd1));
|
||||||
|
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||||
|
VO_CThreadMy.Make(ZftMCP(VO_ZCStringStd1), ZftMCP(VO_ZCStringStd2));
|
||||||
|
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}/*
|
||||||
|
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
};/*
|
||||||
|
template<typename TDummy=void*> class ZtCExamThread*/
|
||||||
|
|
||||||
|
}/*
|
||||||
|
namespace ZNsExam*/
|
||||||
|
|
||||||
|
}/*
|
||||||
|
namespace ZNsMain*/
|
||||||
|
|
||||||
|
|
||||||
|
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||||
|
{
|
||||||
|
return ZNsMain::ZNsExam::
|
||||||
|
|
||||||
|
ZtCExamThread<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||||
|
}/*
|
||||||
|
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||||
|
|
||||||
|
|
||||||
|
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
■ cigwin 컴파일
|
||||||
|
|
||||||
|
// g++ -mno-cygwin -o ZtCThreadEx_000.exe ZtCThreadEx_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||||
|
// g++ -mno-cygwin -o ZtCThreadEx_000_D.exe ZtCThreadEx_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||||
|
|
||||||
|
■ mingw 컴파일
|
||||||
|
|
||||||
|
g++.exe -o ZtCThreadEx_000_mw.exe ZtCThreadEx_000.cpp -I../
|
||||||
|
g++.exe -o ZtCThreadEx_000_mw_D.exe ZtCThreadEx_000.cpp -I../ -D_DEBUG
|
||||||
|
|
||||||
|
./ZtCThreadEx_000_mw.exe
|
||||||
|
./ZtCThreadEx_000_mw_D.exe
|
||||||
|
|
||||||
|
|
||||||
|
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||||
|
# date
|
||||||
|
Sun Aug 24 10:47:09 KST 2025
|
||||||
|
|
||||||
|
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||||
|
# g++ --version
|
||||||
|
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||||
|
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
|
||||||
|
■ Linux 컴파일
|
||||||
|
|
||||||
|
g++ -std=c++98 -o ZtCThreadEx_000.exe ZtCThreadEx_000.cpp -I../ -lpthread
|
||||||
|
g++ -std=c++98 -o ZtCThreadEx_000_D.exe ZtCThreadEx_000.cpp -I../ -lpthread -D_DEBUG
|
||||||
|
|
||||||
|
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||||
|
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||||
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||||
|
Sun Aug 24 00:05:51 DST 2025
|
||||||
|
|
||||||
|
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||||
|
NAME="Ubuntu"
|
||||||
|
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||||
|
ID=ubuntu
|
||||||
|
ID_LIKE=debian
|
||||||
|
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||||
|
VERSION_ID="20.04"
|
||||||
|
HOME_URL="https://www.ubuntu.com/"
|
||||||
|
SUPPORT_URL="https://help.ubuntu.com/"
|
||||||
|
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||||
|
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||||
|
VERSION_CODENAME=focal
|
||||||
|
UBUNTU_CODENAME=focal
|
||||||
|
|
||||||
|
|
||||||
|
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||||
|
CentOS Linux release 7.9.2009 (Core)
|
||||||
|
|
||||||
|
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||||
|
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||||
|
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
■ 실행
|
||||||
|
|
||||||
|
./ZtCThreadEx_000.exe
|
||||||
|
./ZtCThreadEx_000_D.exe
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////*/
|
Reference in New Issue
Block a user