mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 03:02:30 +00:00
chore: initial commit
This commit is contained in:
commit
70b00c5c38
965 changed files with 264882 additions and 0 deletions
55
src/net/connection/WowConnectionNet.hpp
Normal file
55
src/net/connection/WowConnectionNet.hpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#ifndef NET_CONNECTION_WOW_CONNECTION_NET_HPP
|
||||
#define NET_CONNECTION_WOW_CONNECTION_NET_HPP
|
||||
|
||||
#include "net/connection/WowConnection.hpp"
|
||||
#include <cstdint>
|
||||
#include <storm/List.hpp>
|
||||
#include <storm/Thread.hpp>
|
||||
|
||||
class WowConnectionNet {
|
||||
public:
|
||||
// Types
|
||||
struct Worker {
|
||||
WowConnectionNet* owner;
|
||||
SThread thread;
|
||||
int32_t id;
|
||||
WowConnection* serviceConn;
|
||||
SEvent event = SEvent(0, 0);
|
||||
int8_t quit;
|
||||
SCritSect lock;
|
||||
};
|
||||
|
||||
// Member variables
|
||||
SThread m_thread;
|
||||
SEvent m_stopEvent = SEvent(1, 0);
|
||||
uint8_t m_stop;
|
||||
int32_t m_numWorkers;
|
||||
Worker m_workers[32];
|
||||
SCritSect m_connectionsLock;
|
||||
STORM_EXPLICIT_LIST(WowConnection, m_netlink) m_connections;
|
||||
SSemaphore m_workerSem;
|
||||
void (*m_threadinit)();
|
||||
|
||||
// Member functions
|
||||
WowConnectionNet(uint32_t numThreads, void (*threadinit)())
|
||||
: m_workerSem(0, numThreads)
|
||||
, m_numWorkers(numThreads)
|
||||
, m_threadinit(threadinit)
|
||||
, m_stop(0)
|
||||
{};
|
||||
void Add(WowConnection* connection);
|
||||
void Delete(WowConnection* connection);
|
||||
void PlatformAdd(WowConnection* connection);
|
||||
void PlatformChangeState(WowConnection* connection, WOW_CONN_STATE state);
|
||||
void PlatformInit(bool useEngine);
|
||||
void PlatformRun();
|
||||
void PlatformWorkerReady();
|
||||
void Remove(WowConnection* connection);
|
||||
void Run();
|
||||
void RunWorker(int32_t id);
|
||||
void Service(WowConnection* connection, uint32_t serviceFlags);
|
||||
void SignalWorker(WowConnection* connection, uint32_t flags);
|
||||
void Start();
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue