Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Unified Diff: util/test/multiprocess.h

Issue 586053002: MachMultiprocess test: the child process must wait for the parent to finish (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Handle it in the base class Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/test/mac/mach_multiprocess.cc ('k') | util/test/multiprocess.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/test/multiprocess.h
diff --git a/util/test/multiprocess.h b/util/test/multiprocess.h
index 371d23f1d22421495be449f56da4f4bb7868cab4..781ec7c13a2fe88eeb6c60e4d26ef0760b5f5268 100644
--- a/util/test/multiprocess.h
+++ b/util/test/multiprocess.h
@@ -116,6 +116,10 @@ class Multiprocess {
//! This method may be called by either the parent or the child process.
//! Anything written to the write pipe in the partner process will appear
//! on the this file descriptor in this process.
+ //!
+ //! It is an error to call this after CloseReadPipe() has been called.
+ //!
+ //! \return The read pipe’s file descriptor.
int ReadPipeFD() const;
//! \brief Returns the write pipe’s file descriptor.
@@ -123,8 +127,26 @@ class Multiprocess {
//! This method may be called by either the parent or the child process.
//! Anything written to this file descriptor in this process will appear on
//! the read pipe in the partner process.
+ //!
+ //! It is an error to call this after CloseWritePipe() has been called.
+ //!
+ //! \return The write pipe’s file descriptor.
int WritePipeFD() const;
+ //! \brief Closes the read pipe.
+ //!
+ //! This method may be called by either the parent or the child process. An
+ //! attempt to write to the write pipe in the partner process will fail with
+ //! `EPIPE` or `SIGPIPE`. ReadPipeFD() must not be called after this.
+ void CloseReadPipe();
+
+ //! \brief Closes the write pipe.
+ //!
+ //! This method may be called by either the parent or the child process. An
+ //! attempt to read from the read pipe in the partner process will indicate
+ //! end-of-file. WritePipeFD() must not be called after this.
+ void CloseWritePipe();
+
private:
//! \brief Runs the parent side of the test.
//!
« no previous file with comments | « util/test/mac/mach_multiprocess.cc ('k') | util/test/multiprocess.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698