MCPcopy Create free account
hub / github.com/dobin/RedEdr / PplReaderInit

Function PplReaderInit

RedEdr/pplreader.cpp:29–59  ·  view source on GitHub ↗

Init

Source from the content-addressed store, hash-verified

27
28// Init
29bool PplReaderInit(std::vector<HANDLE>& threads) {
30 hStopEventPpl = CreateEvent(NULL, TRUE, FALSE, NULL);
31 if (hStopEventPpl == NULL) {
32 LOG_A(LOG_ERROR, "PplReader: Failed to create stop event");
33 return false;
34 }
35 threadReadynessPpl = CreateEvent(NULL, TRUE, FALSE, NULL);
36 if (threadReadynessPpl == NULL) {
37 LOG_A(LOG_ERROR, "PplReader: Failed to create event for thread readiness");
38 CloseHandle(hStopEventPpl);
39 hStopEventPpl = NULL;
40 return false;
41 }
42
43 HANDLE thread = CreateThread(NULL, 0, PplReaderThread, NULL, 0, NULL);
44 if (thread == NULL) {
45 LOG_A(LOG_ERROR, "PplReader: Failed to create thread");
46 CloseHandle(threadReadynessPpl);
47 threadReadynessPpl = NULL;
48 CloseHandle(hStopEventPpl);
49 hStopEventPpl = NULL;
50 return false;
51 }
52 hPplThreadHandle = thread;
53
54 // Wait for the client to connect (PPL service should already be running)
55 WaitForSingleObject(threadReadynessPpl, INFINITE);
56 Sleep(200); // it has to bind() n stuff
57 threads.push_back(thread);
58 return true;
59}
60
61
62// Pipe Reader Thread: Server

Callers 1

ManagerStartFunction · 0.85

Calls 1

LOG_AFunction · 0.70

Tested by

no test coverage detected