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