mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
add two way IPC
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <Sddl.h>
|
||||
#include <accctrl.h>
|
||||
#include <aclapi.h>
|
||||
#include <list>
|
||||
|
||||
class TwoWayPipeMessageIPC
|
||||
{
|
||||
@@ -53,6 +54,7 @@ private:
|
||||
std::thread output_queue_thread;
|
||||
std::thread input_pipe_thread;
|
||||
std::mutex pipe_connect_handle_mutex; // For manipulating the current_connect_pipe
|
||||
std::wstring outgoing_message; // Store the updated json settings.
|
||||
|
||||
HANDLE current_connect_pipe_handle = NULL;
|
||||
bool closed = false;
|
||||
@@ -129,7 +131,6 @@ private:
|
||||
CloseHandle(output_pipe_handle);
|
||||
return;
|
||||
}
|
||||
|
||||
void consume_output_queue_thread()
|
||||
{
|
||||
while (!closed)
|
||||
@@ -465,12 +466,20 @@ private:
|
||||
{
|
||||
while (!closed)
|
||||
{
|
||||
outgoing_message = L"";
|
||||
std::wstring message = input_queue.pop_message();
|
||||
if (message.length() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
dispatch_inc_message_function(message);
|
||||
|
||||
// Check if callback method exists first before trying to call it.
|
||||
// otherwise just store the response message in a variable.
|
||||
if (dispatch_inc_message_function != nullptr)
|
||||
{
|
||||
dispatch_inc_message_function(message);
|
||||
}
|
||||
outgoing_message = message;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user