replace pthread with c++ thread

This commit is contained in:
springzfx
2020-05-30 00:14:18 +08:00
parent cc83c1ae55
commit ec9609cec8
5 changed files with 45 additions and 62 deletions

View File

@@ -2,6 +2,7 @@
#define SOCKET_SERVER_H
#include <functional>
#include <future>
#include <stdlib.h>
#include <sys/un.h>
using namespace std;
@@ -14,11 +15,6 @@ namespace CGPROXY::SOCKET {
continue; \
}
struct thread_arg {
function<int(char *)> handle_msg;
};
void *startThread(void *arg);
class SocketServer {
public:
int sfd = -1, cfd = -1, flag = -1;
@@ -28,6 +24,8 @@ public:
~SocketServer();
};
void startThread(function<int(char *)> callback, promise<void> status);
} // namespace CGPROXY::SOCKET
#endif