For example, say I allocate a struct with new and write the pointer into the write end of an anonymous pipe.
If I read the pointer from the corresponding read end, am I guaranteed to see the 'correct' contents on the struct?
Also of of interest is whether the results of socketpair() on unix & self connecting over tcp loopback on windows have the same guarantees.
The context is a server design which centralizes event dispatch with select/epoll
To communicate using anonymous pipes within the process or between the process we need a mechanism to pass pipe handle to client so that it can connect to the pipe created by server.Below are the steps. Parent creates Pipe hence its called pipe server. Get the handle for the pipe. Parent creates child and pass pipe handle to child
Pipes are a mechanism for inter process communication in windows.Pipes come in two varieties viz. Anonymous pipes and Named pipes.Anonymous pipes as name suggest do not have a name and can be used to communicate between threads or two related processes i.e. when one process initiates another process.
Anonymous pipes provide interprocess communication on a local computer. They offer less functionality than named pipes, but also require less overhead. You can use anonymous pipes to make interprocess communication on a local computer easier. You cannot use anonymous pipes for communication over a network.
You can use anonymous pipes to communicate between two threads in the same process.Below is the code for the same. using (AnonymousPipeServerStream pipedServer = new AnonymousPipeServerStream (PipeDirection.Out)) Console.Write (" [CLIENT] Press Enter to continue...");
For example, say I allocate a struct with new and write the pointer into the write end of an anonymous pipe.
If I read the pointer from the corresponding read end, am I guaranteed to see the 'correct' contents on the struct?
No. There is no guarantee that the writing CPU will have flushed the write out of its cache and made it visible to the other CPU that might do the read.
Also of of interest is whether the results of socketpair() on unix & self connecting over tcp loopback on windows have the same guarantees.
No.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With