My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
pipe.h
1 #ifndef pipe_h
2 #define pipe_h
3 
4 /*
5  * This module provides a thread-safe architecture-neutral wrapper
6  * around unnamed pipes. It allows multiple threads to read and/or write
7  * to a pipe, each with different blocking requirements, and hides the
8  * differences between non-blocking I/O return codes on different
9  * architectures.
10  */
11 
12 typedef struct Pipe Pipe;
13 
14 /*
15  * Pipe constructor and destructor functions.
16  */
17 Pipe *new_Pipe(void);
18 Pipe *del_Pipe(Pipe *pipe);
19 
20 /*
21  * Enumerate the return statuses of read_pipe() and write_pipe().
22  */
23 typedef enum {
24  PIPE_OK, /* The I/O completed successfully */
25  PIPE_BUSY, /* The I/O couldn't be performed without blocking */
26  PIPE_ERROR /* An error occurred */
27 } PipeState;
28 
29 /*
30  * Enumerate the two special I/O timeout values.
31  */
32 enum {
33  PIPE_WAIT = -1, /* Wait to complete the transaction */
34  PIPE_NOWAIT = 0 /* Return immediately if the transaction would block */
35 };
36 
37 PipeState read_pipe(Pipe *pipe, void *buffer, size_t nbyte, long timeout);
38 PipeState write_pipe(Pipe *pipe, void *buffer, size_t nbyte, long timeout);
39 
40 /*
41  * To allow select() and poll() to be used with a pipe, the following
42  * functions return the file descriptors of the pipe. Do not use these
43  * fds for any other purpose.
44  */
45 int pipe_read_fd(Pipe *pipe);
46 int pipe_write_fd(Pipe *pipe);
47 
48 #endif
Definition: pipe.c:24
Definition: tVideoCapabilitiesEml.cc:67