Sample 12 — Producer / Consumer 問題

セマフォを使った有限バッファ問題。Producer が 1 秒、Consumer が 2 秒で動くと、しばらくでバッファが満杯になることがわかる。

Sample 12 — Live DemoJS