| 37 | |
| 38 | protected: |
| 39 | void* run(void) |
| 40 | { |
| 41 | for (int i = 0; i < max_; i++) { |
| 42 | TBOX<int> box; |
| 43 | acl::thread_job* job = new producer(box); |
| 44 | threads_.execute(job); |
| 45 | int* n = box.pop(); |
| 46 | delete n; |
| 47 | } |
| 48 | |
| 49 | printf("consumer-%ld finish\r\n", acl::thread::self()); |
| 50 | return NULL; |
| 51 | } |
| 52 | |
| 53 | private: |
| 54 | acl::thread_pool& threads_; |