[size=1em]1
[size=1em]2
[size=1em]3
[size=1em]4
[size=1em]5
[size=1em]6
[size=1em]7
[size=1em]8
[size=1em]9
[size=1em]10
[size=1em]11
| [size=1em][size=1em]-(void)createConsumer{
[size=1em] [condition lock];
[size=1em] while ([products count]==0) {
[size=1em] NSLog(@”wait for product”);
[size=1em] [condition wait];
[size=1em] }
[size=1em] [products removeObjectAtIndex:0];
[size=1em] NSLog(@”consume a product”);
[size=1em] [condition unlock];
[size=1em]}
|