Commit 408efd17 authored by jan.koester's avatar jan.koester
Browse files

change running bool

parent d8ea1b08
Loading
Loading
Loading
Loading
+9 −26
Changes for CMakeSettings.json: 9 added lines, 26 removed lines.
Original line number Diff line number Diff line
{
  "configurations": [
        {
            "name": "x64-Debug",
            "generator": "Ninja",
            "configurationType": "Debug",
            "buildRoot": "${projectDir}\\out\\build\\${name}",
            "installRoot": "${projectDir}\\out\\install\\${name}",
            "cmakeCommandArgs": "",
            "buildCommandArgs": "",
            "ctestCommandArgs": "",
            "inheritEnvironments": [ "msvc_x64_x64" ]
        },
    {
      "name": "x64-Release",
      "generator": "Ninja",
      "configurationType": "RelWithDebInfo",
            "buildRoot": "${projectDir}\\out\\build\\${name}",
            "installRoot": "${projectDir}\\out\\install\\${name}",
      "buildRoot": "C:/Users/jan.koester/build_blogi/${name}",
      "installRoot": "C:/Users/jan.koester/build_blogi/${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
            "ctestCommandArgs": "",
            "inheritEnvironments": [ "msvc_x64_x64" ]
        },
      "inheritEnvironments": [ "msvc_x64_x64" ],
      "variables": [
        {
            "name": "x86-Debug",
            "generator": "Ninja",
            "configurationType": "Debug",
            "buildRoot": "${projectDir}\\out\\build\\${name}",
            "installRoot": "${projectDir}\\out\\install\\${name}",
            "cmakeCommandArgs": "",
            "buildCommandArgs": "",
            "ctestCommandArgs": "",
            "inheritEnvironments": [ "msvc_x86" ],
            "variables": []
          "name": "CMAKE_INSTALL_PREFIX",
          "value": "C:/Users/jan.koester/build_blogi/install",
          "type": "PATH"
        }
      ]
    }
  ]
}
 No newline at end of file
+4 −3
Changes for src/event/epoll.cpp: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -58,7 +58,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define BLOCKSIZE 16384

namespace netplus {
    bool RUNNING=true;

    std::atomic<bool> event::Running = true;

    std::vector<socket*> SSOCKETS;
    std::map<int,con*>    CONNECTIONS;
@@ -372,7 +373,7 @@ namespace netplus {
            int wait=0;

            // In EventWorker::EventWorker:
            while(RUNNING){
            while(event::Running){
                try {
                    wait=pollptr.waitEventHandler(eargs->timeout);
                    for(int i =0; i<wait; ++i){
@@ -496,7 +497,7 @@ namespace netplus {
                        ccon.second->csock->close();
                    }
                }
                RUNNING=false;
                event::Running=false;
                break;
            default:
                break;
+4 −4
Changes for src/event/iocp.cpp: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -54,12 +54,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define BLOCKSIZE 16384

namespace netplus {
      bool RUNNING=true;
	std::atomic<bool> event::Running = true;

    BOOL WINAPI ConsoleHandler(DWORD event) {
        switch (event) {
            case CTRL_C_EVENT:
                    RUNNING=false;
                event::Running=false;
				WSACleanup();
                return TRUE;
             default:
@@ -217,7 +217,7 @@ namespace netplus {
	public:
		EventWorker(int tid, ULONG_PTR args, EventWorkerArgs* eargs) {

			while (RUNNING) {
			while (event::Running) {
				OVERLAPPED* pOverlapped = nullptr;
				ULONG_PTR   lpContext = 0;
				DWORD       dwBytesTransfered = 0;
@@ -386,7 +386,7 @@ namespace netplus {
			throw exp;
		}

		while (RUNNING) {
		while (event::Running) {
			// This is the correct blocking call. It waits for the g_hAcceptEvent to be signaled.
			DWORD dwResult = WSAWaitForMultipleEvents(1, &g_hAcceptEvent, FALSE, _Timeout, FALSE);

+4 −3
Changes for src/event/kqueue.cpp: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -55,7 +55,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define BLOCKSIZE 16384

namespace netplus {
    std::atomic<bool> RUNNING(true);
    std::atomic<bool> event::Running = true;

    std::mutex POLL_HANDLER_MUTEX;

    std::vector<socket*> SSOCKETS;
@@ -397,7 +398,7 @@ public:
        poll pollptr(eargs->ssocket, eargs->event, eargs->pollfd, eargs->timeout);
        int wait = 0;

        while (RUNNING) {
        while (event::Running) {
            try {
                wait = pollptr.waitEventHandler(eargs->timeout);
                for (int i = 0; i < wait; ++i) {
@@ -499,7 +500,7 @@ public:
                        ccon.second->csock->close();
                    }
                }
                RUNNING=false;
                event::Running=false;
                break;
            default:
                break;
+2 −2
Changes for src/eventapi.h: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -59,8 +59,8 @@ namespace netplus {

            virtual ~event();

            static bool _Run;
            static bool _Restart;
            static bool Restart;
			static std::atomic<bool> Running;

            int                      threads;
        protected: