Distributed programming: Difference between revisions

→‎{{header|C}}: correction and comments
(→‎{{header|C}}: using PVM)
(→‎{{header|C}}: correction and comments)
Line 140:
printf("Spawning successful\n");
 
/* pvm_recv(task_id, msgtag). msgtag identifies what kind of data it is,
* for here: 1 = (int, double), 2 = (int, int)
* The receiving order is intentionally swapped, just to show.
*/
* task_id = -1 means "receive from any task"
*/
pvm_recv(-1, 2);
pvm_unpackf("%d %d", &i_data, &i2);
printf("got msg type 12: %d %d\n", i_data, i2);
 
pvm_recv(-1, 1);
pvm_unpackf("%d %lf", &i_data, &f_data);
printf("got msg type 21: %d %f\n", i_data, f_data);
} else {
parent = pvm_parent();
Anonymous user