1 #ifndef SZA_UTIL_PIPE_H
2 #define SZA_UTIL_PIPE_H
72 virtual void readPipe(
void *buffer,
size_t nbyte,
long timeout);
79 virtual void writePipe(
void *buffer,
size_t nbyte,
long timeout);
86 virtual PipeState
read(
void *buffer,
size_t nbyte,
long timeout=PIPE_NOWAIT);
93 virtual PipeState
write(
void *buffer,
size_t nbyte,
long timeout=PIPE_NOWAIT);
180 char unread_[PIPE_BUF];
void getTimeOfDay(struct timespec *ts)
Get the current time of day.
virtual PipeState read(void *buffer, size_t nbyte, long timeout=0)
Read from the pipe.
PipeFd writefd_
File descriptor corresponding to the write end of the pipe.
fd_set rfds()
Return an intialized set of readable file descriptors associated with this queue. ...
bool guardIsReady_
True when the guard mutex has been initialized.
int fd()
Return the file descriptor associated with this pipe.
virtual void writePipe(void *buffer, size_t nbyte, long timeout)
Write to the pipe.
int fd_
The file descriptor.
pthread_cond_t retry_
A condition variable which can be used for other threads to signal when the fd is readable or writabl...
A class to encapsulate a pipe.
void fillPipeFd()
Initialize the pipe fds.
pthread_mutex_t guard_
A mutex guard for the pipe.
size_t nread_
The number of bytes in buffer[].
bool retryIsReady_
True when retry has been initialized.
PipeFd readfd_
File descriptor corresponding to the read end of the pipe.
virtual void readPipe(void *buffer, size_t nbyte, long timeout)
Read from the pipe.
virtual PipeState write(void *buffer, size_t nbyte, long timeout=0)
Write to the pipe.
Define a struct to encapsulate a file descriptor associated with either end of a pipe.
virtual ~Pipe()
Destructor.