FreeRDP
Loading...
Searching...
No Matches
MessagePipe.c
1
20#include <winpr/config.h>
21#include <winpr/assert.h>
22
23#include <winpr/crt.h>
24#include <winpr/sysinfo.h>
25
26#include <winpr/collections.h>
27
36void MessagePipe_PostQuit(wMessagePipe* pipe, int nExitCode)
37{
38 WINPR_ASSERT(pipe);
39 MessageQueue_PostQuit(pipe->In, nExitCode);
40 MessageQueue_PostQuit(pipe->Out, nExitCode);
41}
42
47wMessagePipe* MessagePipe_New(void)
48{
49 wMessagePipe* pipe = (wMessagePipe*)calloc(1, sizeof(wMessagePipe));
50
51 if (!pipe)
52 return nullptr;
53
54 pipe->In = MessageQueue_New(nullptr);
55 if (!pipe->In)
56 goto fail;
57
58 pipe->Out = MessageQueue_New(nullptr);
59 if (!pipe->Out)
60 goto fail;
61
62 return pipe;
63
64fail:
65 MessagePipe_Free(pipe);
66 return nullptr;
67}
68
69void MessagePipe_Free(wMessagePipe* pipe)
70{
71 if (pipe)
72 {
73 MessageQueue_Free(pipe->In);
74 MessageQueue_Free(pipe->Out);
75
76 free(pipe);
77 }
78}