Ignore:
Timestamp:
Oct 29, 2020, 3:33:45 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
93068e53
Parents:
b35ab2d
Message:

Fixed the cycle benchmark, and implemented go equivalent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/readyQ/cycle.cfa

    rb35ab2d r0b84b15  
    44        Partner * partner;
    55        unsigned long long count;
    6         bool first;
    76};
    87
     
    1211
    1312void main( Partner & this ) {
    14         thread_loop {
     13        this.count = 0;
     14        for() {
    1515                park();
    1616                unpark( *this.partner );
     17                this.count ++;
     18                if( clock_mode && stop) break;
     19                if(!clock_mode && this.count >= stop_count) break;
    1720        }
    1821
    1922        __atomic_fetch_add(&threads_left, -1, __ATOMIC_SEQ_CST);
    20 
    21         if(this.first) park();
    2223}
    2324
     
    4142                                unsigned pi = (i + nthreads) % tthreads;
    4243                                threads[i].partner = &threads[pi];
    43                                 threads[i].first = i < nthreads;
    4444                        }
    4545                        printf("Starting\n");
     
    5151                                unpark( threads[i] );
    5252                        }
    53                         wait(start, end, is_tty);
     53                        wait(start, is_tty);
    5454
    5555                        stop = true;
Note: See TracChangeset for help on using the changeset viewer.