home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- * *
- * @@@@ @@@ @@@@@ @@@@@ @@@@@ @@@ @@@@ @ @ @@@@@ @@@@@ @@@@ @@@ *
- * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ *
- * @ @ @ @@@@@ @ @@@@@ @ @@@@@ @ @ @ @@@@@ @ @ @ *
- * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ *
- * @@@@ @@@ @@@@@ @ @ @ @@@ @@@@ @@@@@ @ @@@@@ @@@@ @@@ *
- * *
- * A compiler for distributed programming with C *
- * *
- * m a i n . d c *
- * *
- * Version 1.0 CreationDate: 17.07.91 *
- * LastUpDate: 17.07.91 *
- * *
- *The main program starting all processes of the producer/consumer example.*
- * *
- * Copyright (C) 1990,1991 by Christoph Pleier. *
- * All rights reserved! *
- ***************************************************************************/
-
- #include "config.h"
-
- main()
- {
- long i, /* loop counter */
- prod_num, /* number of producers to create */
- cons_num, /* number of consumers to create */
- msgnum; /* number of message to produce */
- process buffer b; /* process descriptor of buffer */
-
- printf("\nProducer/Consument:\n\n");
- printf("How many producer processes should be started? ");
- scanf("%d", &prod_num);
- printf("How many messages should each producer process produce? ");
- scanf("%d", &msgnum);
- printf("How many consumer processes should be started? ");
- scanf("%d", &cons_num);
-
- printf("\ncreating buffer...");
- fflush(stdout);
- b = create buffer();
- puts("done!");
-
- printf("creating consumer(s)...");
- fflush(stdout);
- for(i = 1; i <= cons_num; i++)
- create consumer(i, b);
- puts("done!");
-
- printf("creating producer(s)...");
- fflush(stdout);
- for(i = 1; i <= prod_num; i++)
- create producer(i, b, msgnum);
- puts("done!\n");
- }
-