Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
61 lines
1.0 KiB
C++
61 lines
1.0 KiB
C++
#ifndef _CTHREADMGR_H_
|
|
#define _CTHREADMGR_H_
|
|
|
|
#ifndef WINDOWS_LEAN_AND_MEAN
|
|
#define WINDOWS_LEAN_AND_MEAN
|
|
#endif
|
|
|
|
#include <winsock2.h>
|
|
#include <windows.h>
|
|
#include <process.h>
|
|
|
|
#include "Lock.h"
|
|
|
|
// forward decl
|
|
class CThread;
|
|
|
|
class CThreadMgr
|
|
{
|
|
public:
|
|
|
|
enum { MAX_THREAD_NUM = 63 };
|
|
|
|
CThreadMgr();
|
|
virtual ~CThreadMgr();
|
|
|
|
bool RegisterAndRun(CThread* lpThread); // 스레드를 등록한다. 최대 63개까지 등록할 수 있다.
|
|
bool JoinThread(); // 모든 스레드를 종료시킨다.
|
|
|
|
inline int GetNum()
|
|
{
|
|
return m_nThreadNum;
|
|
}
|
|
inline int GetMaxNum()
|
|
{
|
|
return MAX_THREAD_NUM;
|
|
}
|
|
|
|
CThread* GetThread(int iPos)
|
|
{
|
|
return m_lpThreads[iPos];
|
|
}
|
|
|
|
|
|
// 매니저에 등록하지 않고, 그냥 실행 시킨다.
|
|
static HANDLE Run(CThread* lpThread);
|
|
static bool Stop(CThread* lpThread, unsigned long dwTimeout = INFINITE);
|
|
|
|
private:
|
|
|
|
typedef CCSLock ThreadLock;
|
|
|
|
CThread* m_lpThreads[MAX_THREAD_NUM];
|
|
HANDLE m_hThreads[MAX_THREAD_NUM];
|
|
|
|
ThreadLock m_ThreadLock;
|
|
|
|
unsigned int m_nThreadNum;
|
|
unsigned int m_bJoinStarted;
|
|
};
|
|
|
|
#endif |