Difference between revisions of "Producer&Consumer MP-asincrono"
Jump to navigation
Jump to search
(Created page with "<syntaxhighlight lang="C"> MP-asincrono Procuder(){ produce(x); asend(x,Consumer); while(1){ areceive(Consumer); produce(x); asend(x,Consumer); } } Consumer(){ ...") |
|||
Line 42: | Line 42: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | Fede & Pirata |
Revision as of 18:05, 21 March 2014
MP-asincrono
Procuder(){
produce(x);
asend(x,Consumer);
while(1){
areceive(Consumer);
produce(x);
asend(x,Consumer);
}
}
Consumer(){
while(1){
x = areceive(Producer);
consume(x);
asend(ACK,Producer);
}
}
MP-asincrono dato quello sincrono
#include <slideconcorrenzapg201.h>
Procuder(){
while(1){
produce(x);
asend(x,Consumer);
}
Consumer(){
while(1){
x=areceive(Producer);
consume(x);
}
}
Fede & Pirata