Changeset 34dcc78c for libcfa/src/bits


Ignore:
Timestamp:
Dec 3, 2020, 9:19:55 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
a9a1d06
Parents:
7b2a786
Message:

re-purpose Seqable as Colable for stack

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/multi_list.cfa

    r7b2a786 r34dcc78c  
    5757        }
    5858
    59         // Stack(TaskDL) fredStack;
    60         // for ( Lnth ) {
    61         //      Task & task = *new();                                                   // create task node
    62         //      push( fredStack, task.clusterRef );                             // insert on lists in opposite directions
    63         // }
     59        // Re-purpose Seqable as Colable
     60        Stack(TaskDL) mutexStack;
     61        for ( Lnth ) {
     62                Task & task = *new();                                                   // create task node
     63                push( mutexStack, task.clusterRef );                    // insert on lists in opposite directions
     64        }
     65        for ( StackIter(TaskDL) iter = { mutexStack }; (StackIter(TaskDL) &)iter >> dl; ) { // cast required
     66                sout | &task( dl );
     67        }
     68        sout | nl;
     69        for ( Lnth ) {                                                                          // remove nodes from readyList and safe to delete nodes
     70                delete( &task( pop( mutexStack ) ) );
     71        }
    6472}
Note: See TracChangeset for help on using the changeset viewer.