| 94 | } |
| 95 | |
| 96 | ~pipe_example ( |
| 97 | ) |
| 98 | { |
| 99 | dlog << LINFO << "destructing pipe object: wait for job_pipe to be empty"; |
| 100 | // wait for all the jobs to be processed |
| 101 | job_pipe.wait_until_empty(); |
| 102 | |
| 103 | dlog << LINFO << "destructing pipe object: job_pipe is empty"; |
| 104 | |
| 105 | // now disable the job_pipe. doing this will cause all calls to |
| 106 | // job_pipe.dequeue() to return false so our threads will terminate |
| 107 | job_pipe.disable(); |
| 108 | |
| 109 | // now block until all the threads have terminated |
| 110 | wait(); |
| 111 | dlog << LINFO << "destructing pipe object: all threads have ended"; |
| 112 | } |
| 113 | |
| 114 | // Here we declare our pipe object. It will contain our job objects. |
| 115 | // There are only two requirements on the type of objects you can use in a |