semaphore e = 10; semaphore f = 0; char buf[10]; void producent(){ int i = 0; char c; for (c = 'a';c <= 'z'; c++){ p(e); buf[i] = c; cout << "Produkuji " << c << endl; i = (i + 1) % 10; v(f); } } void konzument(){ int i; char c; for(;;){ p(f); c = buf[i]; i = (i + 1) % 10; cout << "Konzumuji " << c << endl; v(e); if (c == 'z'){ return; } } } main(){ cobegin { producent(); konzument(); } }