/home/barant/Development/BMA/server_core/ServerCore/BMAEPoll.h
#ifndef __BMAEPoll_h__
#define __BMAEPoll_h__
#include "BMALog.h"
#include "BMASocket.h"
#include "BMAThread.h"
#include "BMASession.h"
#include "BMACommand.h"
class BMAEPoll : public BMACommand {
public:
BMAEPoll();
~BMAEPoll();
bool start(int numberOfThreads, int maxSockets);
bool stop();
bool isStopping();
bool registerSocket(BMASocket *socket);
bool unregisterSocket(BMASocket *socket);
int getDescriptor();
int maxSockets;
void eventReceived(struct epoll_event event);
void processCommand(std::string command, BMASession *session) override;
private:
int epfd;
int numberOfThreads;
std::map<int, BMASocket *> sockets;
std::vector<BMAThread> threads;
volatile bool terminateThreads;
std::mutex lock;
};
#endif
BMAEPoll::maxSockets
int maxSockets
The maximum number of socket allowed.
Definition: BMAEPoll.h:96
BMASocket
Definition: BMASocket.h:31
BMAEPoll::processCommand
void processCommand(std::string command, BMASession *session) override
Output the threads array to the console.
Definition: BMAEPoll.cpp:112
BMAEPoll::getDescriptor
int getDescriptor()
Return the descriptor for the ePoll socket.
Definition: BMAEPoll.cpp:108
BMAEPoll::BMAEPoll
BMAEPoll()
Definition: BMAEPoll.cpp:7
BMAEPoll
Definition: BMAEPoll.h:29
BMAEPoll::unregisterSocket
bool unregisterSocket(BMASocket *socket)
Unregister a BMASocket from monitoring by BMAEPoll.
Definition: BMAEPoll.cpp:83
BMAEPoll::registerSocket
bool registerSocket(BMASocket *socket)
Register a BMASocket for monitoring by BMAEPoll.
Definition: BMAEPoll.cpp:70
BMAEPoll::start
bool start(int numberOfThreads, int maxSockets)
Start the BMAEPoll processing.
Definition: BMAEPoll.cpp:20
BMACommand
Definition: BMACommand.h:8
BMAEPoll::eventReceived
void eventReceived(struct epoll_event event)
Dispatch event to appropriate socket.
Definition: BMAEPoll.cpp:96
BMAEPoll::isStopping
bool isStopping()
Returns a true if the stop command has been requested.
Definition: BMAEPoll.cpp:66
BMAEPoll::stop
bool stop()
Stop and shut down the BMAEPoll processing.
Definition: BMAEPoll.cpp:46
BMASession
Definition: BMASession.h:18
BMAEPoll::~BMAEPoll
~BMAEPoll()
Definition: BMAEPoll.cpp:16