Fixed multithread sync issue and duplicate thread on termination.

This commit is contained in:
Brad Arant committed 2023-03-11 21:55:33 -08:00
1 parent b0118cfc56
commit cfa70c5863
72 files changed
+395 -427

No files matched your search

+1 -22
View File
@@ -69,24 +69,7 @@ namespace core {
///
bool isStopping(); ///< Returns a true if the stop command has been requested.
///
/// Use registerSocket to add a new socket to the ePoll event watch list. This enables
/// a new BMASocket object to receive events when data is received as well as to write
/// data output to the socket.
///
/// @param socket a pointer to a BMASocket object.
/// @return a booelean that indicates the socket was registered or not.
///
bool registerSocket(Socket *socket); ///< Register a BMASocket for monitoring by BMAEPoll.
///
/// Use this method to remove a socket from receiving events from the epoll system.
///
bool unregisterSocket(Socket *socket); ///< Unregister a BMASocket from monitoring by BMAEPoll.
///
/// Use this method to obtain the current descriptor socket number for the epoll function call.
///
@@ -114,16 +97,12 @@ namespace core {
int processCommand(coreutils::ZString &request, TCPSession &session) override; ///<Output the threads array to the console.
void resetSocket(Socket *socket);
private:
int epfd;
int numberOfThreads;
std::vector<Thread> threads;
volatile bool terminateThreads;
void enableSocket(Socket *socket);
void disableSocket(Socket *socket);
};