Changeset 1213f21


Ignore:
Timestamp:
May 27, 2018, 10:20:46 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
13e8427
Parents:
40de461
Message:

formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/concurrent/examples/datingService.c

    r40de461 r1213f21  
    88// Created On       : Mon Oct 30 12:56:20 2017
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Wed Mar 14 22:48:40 2018
    11 // Update Count     : 23
     10// Last Modified On : Sun May 27 09:05:18 2018
     11// Update Count     : 26
    1212//
    1313
     
    1818#include <unistd.h>                                                                             // getpid
    1919
    20 enum { NoOfPairs = 20 };
     20enum { CompCodes = 20 };                                                                // number of compatibility codes
    2121
    2222monitor DatingService {
    23         condition Girls[NoOfPairs], Boys[NoOfPairs];
     23        condition Girls[CompCodes], Boys[CompCodes];
    2424        unsigned int GirlPhoneNo, BoyPhoneNo;
    2525}; // DatingService
     
    4747} // DatingService boy
    4848
    49 unsigned int girlck[NoOfPairs];
    50 unsigned int boyck[NoOfPairs];
     49unsigned int girlck[CompCodes];
     50unsigned int boyck[CompCodes];
    5151
    5252thread Girl {
     
    8888int main() {
    8989        DatingService TheExchange;
    90         Girl * girls[NoOfPairs];
    91         Boy  * boys[NoOfPairs];
     90        Girl * girls[CompCodes];
     91        Boy  * boys[CompCodes];
    9292
    9393        srandom( /*getpid()*/ 103 );
    9494
    95         for ( unsigned int i = 0; i < NoOfPairs; i += 1 ) {
     95        for ( unsigned int i = 0; i < CompCodes; i += 1 ) {
    9696                girls[i] = new( &TheExchange, i, i );
    97                 boys[i]  = new( &TheExchange, i, NoOfPairs - ( i + 1 ) );
     97                boys[i]  = new( &TheExchange, i, CompCodes - ( i + 1 ) );
    9898        } // for
    9999
    100         for ( unsigned int i = 0; i < NoOfPairs; i += 1 ) {
     100        for ( unsigned int i = 0; i < CompCodes; i += 1 ) {
    101101                delete( boys[i] );
    102102                delete( girls[i] );
    103103        } // for
    104104
    105         for ( unsigned int i = 0; i < NoOfPairs; i += 1 ) {
     105        for ( unsigned int i = 0; i < CompCodes; i += 1 ) {
    106106                if ( girlck[ boyck[i] ] != boyck[ girlck[i] ] ) abort();
    107107        } // for
Note: See TracChangeset for help on using the changeset viewer.