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