summaryrefslogtreecommitdiffhomepage
path: root/NetEx/HttpServletExec.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-03-30 18:55:34 +0200
committerAki <please@ignore.pl>2022-03-30 18:55:34 +0200
commit1c17ced79815c94d704bc042f22dc5a0df1df187 (patch)
tree98ccc2e248a9c384e5038ba6c9a4b84a50468530 /NetEx/HttpServletExec.cpp
parent51df86b38668f413c078fd96a0b8828dcd8561ef (diff)
downloadstarshatter-1c17ced79815c94d704bc042f22dc5a0df1df187.zip
starshatter-1c17ced79815c94d704bc042f22dc5a0df1df187.tar.gz
starshatter-1c17ced79815c94d704bc042f22dc5a0df1df187.tar.bz2
Removed windows header uses in HttpServletExec
Diffstat (limited to 'NetEx/HttpServletExec.cpp')
-rw-r--r--NetEx/HttpServletExec.cpp33
1 files changed, 8 insertions, 25 deletions
diff --git a/NetEx/HttpServletExec.cpp b/NetEx/HttpServletExec.cpp
index e7e1c2b..bbd7efe 100644
--- a/NetEx/HttpServletExec.cpp
+++ b/NetEx/HttpServletExec.cpp
@@ -14,7 +14,9 @@
#include "HttpServletExec.h"
#include <stdio.h>
-#include <windows.h>
+
+#include <cstdint>
+#include <thread>
#include "HttpRequest.h"
#include "HttpResponse.h"
@@ -93,18 +95,13 @@ public:
};
-DWORD WINAPI HttpServletExecSessionProc(LPVOID link);
-
-
-HttpServletExec::HttpServletExec(WORD port, int poolsize) :
+HttpServletExec::HttpServletExec(std::uint16_t port, int poolsize) :
HttpServer(port, poolsize),
session_timeout(60),
exec_shutdown(false)
{
http_server_name = "Generic HttpServletExec 1.0";
-
- DWORD thread_id = 0;
- hsession = CreateThread(0, 4096, HttpServletExecSessionProc, (LPVOID) this, 0, &thread_id);
+ hsession = std::thread([&]{ CheckSessions(); });
}
@@ -113,9 +110,8 @@ HttpServletExec::~HttpServletExec()
if (!exec_shutdown)
exec_shutdown = true;
- WaitForSingleObject(hsession, 1000);
- CloseHandle(hsession);
- hsession = 0;
+ if (hsession.joinable())
+ hsession.join();
sessions.destroy();
}
@@ -189,18 +185,7 @@ HttpServletExec::DoGet(HttpRequest& request, HttpResponse& response)
}
-DWORD WINAPI HttpServletExecSessionProc(LPVOID link)
-{
- HttpServletExec* exec = (HttpServletExec*) link;
-
- if (exec)
- return exec->CheckSessions();
-
- return (DWORD) E_POINTER;
-}
-
-
-DWORD
+void
HttpServletExec::CheckSessions()
{
while (!exec_shutdown) {
@@ -223,8 +208,6 @@ HttpServletExec::CheckSessions()
sync.unlock();
Sleep(100);
}
-
- return 0;
}