Ignore:
Timestamp:
Feb 1, 2023, 4:31:15 PM (22 months ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
1f35220
Parents:
a4ab235
Message:

fixed bug where I used buffer as a stack not a queue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/actor.hfa

    ra4ab235 r5c473c9  
    5959    dlist( request ) list;
    6060    request * buffer;
    61     size_t count, buffer_size;
     61    size_t count, buffer_size, index;
    6262};
    6363static inline void ?{}( copy_queue & this ) {}
     
    6767    buffer = aalloc( buffer_size );
    6868    count = 0;
     69    index = 0;
    6970}
    7071static inline void ^?{}( copy_queue & this ) with(this) { adelete(buffer); }
     
    8889        count--;
    8990        should_delete = false;
    90         return buffer[count];
     91        size_t old_idx = index;
     92        index = count == 0 ? 0 : index + 1;
     93        return buffer[old_idx];
    9194    }
    9295    should_delete = true;
Note: See TracChangeset for help on using the changeset viewer.