NetThreadManager.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include "ExternalNetInterface.h"
  3. #include <string>
  4. #include "Poco/Mutex.h"
  5. #include "Poco/Thread.h"
  6. using namespace::std;
  7. using Poco::FastMutex;
  8. using Poco::Mutex;
  9. using Poco::Thread;
  10. class CNetThreadManager
  11. {
  12. public:
  13. static int InsertNetThread(string);
  14. static int DeleteNetThread(string);
  15. static string GetHandleByThreadId(Thread::TID nThreadId);
  16. static CExternalNetInterface* GetNetThread(string stringUuid, bool bCrossingThread=false);
  17. //sessionidÏà¹Ø
  18. static int GetSessionId(string& stringSessionId);
  19. static int SetSessionId(string stringSessionId);
  20. static void HandleSessionSync(string stringSessionId);
  21. //¹«ÎÀsessionidÏà¹Ø
  22. static int SetGWSessionId(string stringSessionId);
  23. static int GetGWSessionId(string& stringSessionId);
  24. static void HandleGWSessionSync(string stringSessionId);
  25. public:
  26. static map<string, CExternalNetInterface*> m_map;
  27. static map<Thread::TID, string> m_mapTidAndHandle;
  28. static map<string, Thread::TID> m_mapHandleAndTid;
  29. static map<string, Mutex*> m_mapHandleAndMutex;
  30. };