From 939d1cc007c5bb8468f78149a330ee34146ac158 Mon Sep 17 00:00:00 2001 From: sauron Date: Sat, 4 Oct 2025 14:32:09 +0900 Subject: [PATCH] commit 2025-10-04 14:32 edit a bit ZCppMain/ZCProcess.H --- ZCppMain/ZCProcess.H | 26 +++++++++++++------------- ZCppMain/ZCProcess_Linux.H | 12 ++++++------ ZCppMain/ZCProcess_Win.H | 11 +++++------ 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/ZCppMain/ZCProcess.H b/ZCppMain/ZCProcess.H index f59b3b0..4cb1956 100644 --- a/ZCppMain/ZCProcess.H +++ b/ZCppMain/ZCProcess.H @@ -1001,12 +1001,12 @@ namespace ZNsMain typename TDataArg =const TSyncData& , typename TSyncEasy=ZNsMain::ZCCriticSectEasy > - class ZtCSyncObj ////////////////////////////////*/ + class ZtCSyncObj /////////////////////////////////////*/ /*///////////////////////////////////////////////////////////////////////////// - ■ TMutexCondData 클래스를 상속하여 대기상태에 관련된 2 개의 bool 멤버를 갖는다. + ■ TMutexCondData 클래스를 상속하여 대기 상태에 관련된 2 개의 bool 멤버를 갖는다. ■ TMutexCondData 클래스 타입은 mutex 와 조건변수를 가지고 있어야 한다. @@ -1020,14 +1020,14 @@ namespace ZNsMain typedef TMutexCondData TypeData ; typedef TMutexCondData CMutexCondData; protected: - bool mb_MustWait ; - bool mb_DoWaitCond; + bool mb_MustWait; + bool mb_WaitCond; public : ZtCMutexCondDataVar() { - mb_MustWait =false; - mb_DoWaitCond=false; + mb_MustWait= false; + mb_WaitCond= false; }/* ZtCMutexCondDataVar()*/ @@ -1039,9 +1039,9 @@ namespace ZNsMain { if(this->mb_MustWait==true) { - this->mb_DoWaitCond=true ; + this->mb_WaitCond=true ; this->TMutexCondData::WaitCond(); - this->mb_DoWaitCond=false; + this->mb_WaitCond=false; }/* if(this->mb_MustWait==true)*/ } @@ -1064,22 +1064,22 @@ namespace ZNsMain { // nothing to do } - else if(this->mb_DoWaitCond==true) + else if(this->mb_WaitCond==true) { // 이때는 쓰레드가 잠자고 있다면 깨워야 한다. this->TMutexCondData::WakeCond(); - this->mb_DoWaitCond=false; + this->mb_WaitCond=false; }/* - else if(this->mb_DoWaitCond==true)*/ + else if(this->mb_WaitCond==true)*/ } this->TMutexCondData::UnLock(); }/* void SetMustWaitBool(bool AB_MustWait)*/ - bool MustWait () const{return mb_MustWait ;} - bool DoWaitCond() const{return mb_DoWaitCond;} + bool MustWait () const{return mb_MustWait;} + bool DoWaitCond() const{return mb_WaitCond;} public: };/* diff --git a/ZCppMain/ZCProcess_Linux.H b/ZCppMain/ZCProcess_Linux.H index bc697f9..91049f6 100644 --- a/ZCppMain/ZCProcess_Linux.H +++ b/ZCppMain/ZCProcess_Linux.H @@ -4013,8 +4013,8 @@ namespace ZNsMain // 실험용 코드. - bool VB_IsOK1=::pthread_mutex_init(&mh_Mutex, AP_MutexAttr)==ZNsMain::ZNsEnum::ZEThread_OK; - bool VB_IsOK2=::pthread_cond_init (&mh_Cond, AP_CondAttr )==ZNsMain::ZNsEnum::ZEThread_OK; + bool VB_IsOK1= (::pthread_mutex_init(&mh_Mutex, AP_MutexAttr)==ZNsMain::ZNsEnum::ZEThread_OK); + bool VB_IsOK2= (::pthread_cond_init (&mh_Cond, AP_CondAttr )==ZNsMain::ZNsEnum::ZEThread_OK); return (VB_IsOK1 && VB_IsOK2) ? ZNsMain::ZNsEnum::ZEThread_OK : ZNsMain::ZNsEnum::ZEThread_Invalid ; @@ -4111,8 +4111,8 @@ namespace ZNsMain ::gettimeofday(&VO_TimeNow, NULL); - VO_TimeAbs.tv_sec =VO_TimeNow.tv_sec + (AI_TimeOutMili/1000) ; - VO_TimeAbs.tv_nsec=VO_TimeNow.tv_usec*1000 + (AI_TimeOutMili%1000)*1000*1000 ; + VO_TimeAbs.tv_sec = VO_TimeNow.tv_sec + (AI_TimeOutMili/1000) ; + VO_TimeAbs.tv_nsec= VO_TimeNow.tv_usec*1000 + (AI_TimeOutMili%1000)*1000*1000 ; return ::pthread_cond_timedwait(&mh_Cond, &mh_Mutex, &VO_TimeAbs) ; // return ZEThread_TimeOut if timeout }/* @@ -4144,8 +4144,8 @@ namespace ZNsMain // 실험용 코드. - bool VB_IsOK1=::pthread_cond_destroy (&mh_Cond )==ZNsMain::ZNsEnum::ZEThread_OK; - bool VB_IsOK2=::pthread_mutex_destroy(&mh_Mutex)==ZNsMain::ZNsEnum::ZEThread_OK; + bool VB_IsOK1= (::pthread_cond_destroy (&mh_Cond )==ZNsMain::ZNsEnum::ZEThread_OK); + bool VB_IsOK2= (::pthread_mutex_destroy(&mh_Mutex)==ZNsMain::ZNsEnum::ZEThread_OK); return (VB_IsOK1 && VB_IsOK2) ? ZNsMain::ZNsEnum::ZEThread_OK : ZNsMain::ZNsEnum::ZEThread_Invalid ; diff --git a/ZCppMain/ZCProcess_Win.H b/ZCppMain/ZCProcess_Win.H index 0eba631..19dbf6c 100644 --- a/ZCppMain/ZCProcess_Win.H +++ b/ZCppMain/ZCProcess_Win.H @@ -2364,9 +2364,8 @@ namespace ZNsMain ::InitializeConditionVariable(&mo_CondVar); if(::InitializeCriticalSectionEx(&mo_CritSect, ESpinCount, 0)==TRUE) - return ZNsEnum::ZEThread_OK; - else - return ZNsEnum::ZEThread_Invalid; + return ZNsEnum::ZEThread_OK ; + else return ZNsEnum::ZEThread_Invalid; }/* int InitCond()*/ @@ -2423,7 +2422,7 @@ namespace ZNsMain class ZtCMutexCondData : public TData */ -#else // !(defined(__VISUAL_CPP_VER__) && __VISUAL_CPP_VER__>=200800) +#else // !( defined(__VISUAL_CPP_VER__) && __VISUAL_CPP_VER__>=200800 ) template< typename TData=ZNsMain::ZCEmpty @@ -2497,8 +2496,8 @@ namespace ZNsMain }/* if(mb_IsOnWait==false)*/ - DWORD VI_Return = ::SignalObjectAndWait( - mh_MutexSync, mh_EventWait, ADW_TimeOut, FALSE); + DWORD VI_Return = ::SignalObjectAndWait + ( mh_MutexSync, mh_EventWait, ADW_TimeOut, FALSE ); #if(_CODE_BAD_) return (VI_Return==WAIT_OBJECT_0) ? Lock() : VI_Return;