This is useful for handing the pipe to a child process and then closing
the unused end so an end-of-file event can be properly received.
sys_close(write_handle);
}
+void Pipe::set_mode(Mode m)
+{
+ m = m&M_RDWR;
+ if(!m)
+ throw invalid_argument("Pipe::set_mode");
+
+ check_access(m);
+
+ Mode close = mode&M_RDWR&~m;
+ if(close&M_READ)
+ sys_close(read_handle);
+ if(close&M_WRITE)
+ sys_close(write_handle);
+ mode = (mode&~M_RDWR)|m;
+}
+
void Pipe::set_block(bool b)
{
mode = (mode&~M_NONBLOCK);
public:
~Pipe();
+ void set_mode(Mode);
void set_block(bool);
protected: