| 79 | { |
| 80 | public: |
| 81 | pipe_example( |
| 82 | ) : |
| 83 | job_pipe(4) // This 4 here is the size of our job_pipe. The significance is that |
| 84 | // if you try to enqueue more than 4 jobs onto the pipe then enqueue() will |
| 85 | // block until there is room. |
| 86 | { |
| 87 | // register 3 threads |
| 88 | register_thread(*this,&pipe_example::thread); |
| 89 | register_thread(*this,&pipe_example::thread); |
| 90 | register_thread(*this,&pipe_example::thread); |
| 91 | |
| 92 | // start the 3 threads we registered above |
| 93 | start(); |
| 94 | } |
| 95 | |
| 96 | ~pipe_example ( |
| 97 | ) |