Changeset 200fcb3 for doc/papers


Ignore:
Timestamp:
Dec 12, 2018, 9:16:12 AM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
5ebb1368
Parents:
3d99498
Message:

add auto newline to sout, change endl to nl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/concurrency/Paper.tex

    r3d99498 r200fcb3  
    686686        Fib f1, f2;
    687687        for ( int i = 1; i <= 10; i += 1 ) {
    688                 sout | next( f1 ) | next( f2 ) | endl;
     688                sout | next( f1 ) | next( f2 );
    689689        }
    690690}
     
    772772                        sout | "  ";               // separator
    773773                }
    774                 sout | endl;
     774                sout | nl;
    775775        }
    776776}
    777777void ?{}( Format & fmt ) { `resume( fmt );` }
    778778void ^?{}( Format & fmt ) with( fmt ) {
    779         if ( g != 0 || b != 0 ) sout | endl;
     779        if ( g != 0 || b != 0 ) sout | nl;
    780780}
    781781void format( Format & fmt ) {
     
    855855        for ( int i = 0; i < N; i += 1 ) {
    856856                int p1 = random( 100 ), p2 = random( 100 );
    857                 sout | p1 | " " | p2 | endl;
     857                sout | p1 | " " | p2;
    858858                int status = delivery( c, p1, p2 );
    859                 sout | " $" | money | endl | status | endl;
     859                sout | " $" | money | nl | status;
    860860                receipt += 1;
    861861        }
    862862        stop( c );
    863         sout | "prod stops" | endl;
     863        sout | "prod stops";
    864864}
    865865int payment( Prod & prod, int money ) {
     
    895895        int money = 1, receipt;
    896896        for ( ; ! done; ) {
    897                 sout | p1 | " " | p2 | endl | " $" | money | endl;
     897                sout | p1 | " " | p2 | nl | " $" | money;
    898898                status += 1;
    899899                receipt = payment( p, money );
    900                 sout | " #" | receipt | endl;
     900                sout | " #" | receipt;
    901901                money += 1;
    902902        }
    903         sout | "cons stops" | endl;
     903        sout | "cons stops";
    904904}
    905905int delivery( Cons & cons, int p1, int p2 ) {
     
    10991099
    11001100void main(foo & this) {
    1101         sout | "Hello World!" | endl;
     1101        sout | "Hello World!";
    11021102}
    11031103\end{cfa}
     
    11241124
    11251125void hello(/*unused*/ int) {
    1126         sout | "Hello World!" | endl;
     1126        sout | "Hello World!";
    11271127}
    11281128
     
    11411141thread World {};
    11421142void main( World & this ) {
    1143         sout | "World!" | endl;
     1143        sout | "World!";
    11441144}
    11451145int main() {
    11461146        World w`[10]`;                                                  $\C{// implicit forks after creation}$
    1147         sout | "Hello " | endl;                                 $\C{// "Hello " and 10 "World!" printed concurrently}$
     1147        sout | "Hello ";                                        $\C{// "Hello " and 10 "World!" printed concurrently}$
    11481148}                                                                                       $\C{// implicit joins before destruction}$
    11491149\end{cfa}
     
    11931193                total += subtotals[r];                          $\C{// total subtotal}$
    11941194    }
    1195     sout | total | endl;
     1195    sout | total;
    11961196}
    11971197\end{cfa}
     
    21922192        BENCH(
    21932193                for ( size_t i = 0; i < N; i += 1 ) { @resume( c );@ } )
    2194         sout | result`ns | endl;
     2194        sout | result`ns;
    21952195}
    21962196\end{cfa}
     
    22052205        BENCH(
    22062206                for ( size_t i = 0; i < N; i += 1 ) { @yield();@ } )
    2207         sout | result`ns | endl;
     2207        sout | result`ns;
    22082208}
    22092209\end{cfa}
     
    22442244int main() {
    22452245        BENCH( for( size_t i = 0; i < N; i += 1 ) { @do_call( m1/*, m2, m3, m4*/ );@ } )
    2246         sout | result`ns | endl;
     2246        sout | result`ns;
    22472247}
    22482248\end{cfa}
     
    23052305        BENCH( for ( size_t i = 0; i < N; i += 1 ) { @wait( c );@ } );
    23062306        go = 0; // stop other thread
    2307         sout | result`ns | endl;
     2307        sout | result`ns;
    23082308}
    23092309int main() {
     
    23562356        BENCH( for ( size_t i = 0; i < N; i += 1 ) { @waitfor( do_call, m );@ } )
    23572357        go = 0; // stop other thread
    2358         sout | result`ns | endl;
     2358        sout | result`ns;
    23592359}
    23602360int main() {
     
    23912391int main() {
    23922392        BENCH( for ( size_t i = 0; i < N; i += 1 ) { @MyThread m;@ } )
    2393         sout | result`ns | endl;
     2393        sout | result`ns;
    23942394}
    23952395\end{cfa}
Note: See TracChangeset for help on using the changeset viewer.