• David Gibson's avatar
    coroutine: Move total initialization outside coroutine · d24c5a01
    David Gibson authored
    The sample coroutine in api-3 initializes a total to 0, then adds up the
    pseudo-random data it has placed into a stack buffer, to ensure that the
    compiler won't elide the reading and writing of that buffer.  After the
    coroutine has completed, we verify that total is non-zero so that we'll
    detect if the coroutine failed to execute entirely.
    
    Except that the initialization of total is within the coroutine itself,
    so it could also be non-zero due to it simply being uninitialized.  This
    moves the initialization outside the coroutine, to make the test a little
    more robust.
    Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
    d24c5a01
api-3.c 1.86 KB