| 28 | }; |
| 29 | |
| 30 | int main(void) |
| 31 | { |
| 32 | int max = 50000000; |
| 33 | BOX<int> box; |
| 34 | |
| 35 | producer thr(box, max); |
| 36 | thr.start(); |
| 37 | |
| 38 | for (int i = 0; i < max; i++) { |
| 39 | int* n = box.pop(); |
| 40 | assert(*n == i); |
| 41 | delete n; |
| 42 | } |
| 43 | |
| 44 | printf("All over, max=%d\r\n", max); |
| 45 | thr.wait(); |
| 46 | return 0; |
| 47 | } |