Changeset 8119363 in mainline for uspace/lib/c/generic/async/client.c


Ignore:
Timestamp:
2018-06-26T17:35:40Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6e569bf
Parents:
fbfe59d (diff), e768aea (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge some preliminary async/fibril framework changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/async/client.c

    rfbfe59d r8119363  
    121121#include <abi/mm/as.h>
    122122#include "../private/libc.h"
     123#include "../private/fibril.h"
    123124
    124125/** Naming service session */
     
    241242        assert(arg);
    242243
    243         futex_down(&async_futex);
     244        futex_lock(&async_futex);
    244245
    245246        amsg_t *msg = (amsg_t *) arg;
     
    266267        }
    267268
    268         futex_up(&async_futex);
     269        futex_unlock(&async_futex);
    269270}
    270271
     
    355356        amsg_t *msg = (amsg_t *) amsgid;
    356357
    357         futex_down(&async_futex);
     358        futex_lock(&async_futex);
    358359
    359360        assert(!msg->forget);
     
    361362
    362363        if (msg->done) {
    363                 futex_up(&async_futex);
     364                futex_unlock(&async_futex);
    364365                goto done;
    365366        }
     
    370371
    371372        /* Leave the async_futex locked when entering this function */
    372         fibril_switch(FIBRIL_TO_MANAGER);
    373 
    374         /* Futex is up automatically after fibril_switch */
     373        fibril_switch(FIBRIL_FROM_BLOCKED);
     374        futex_unlock(&async_futex);
    375375
    376376done:
     
    401401        amsg_t *msg = (amsg_t *) amsgid;
    402402
    403         futex_down(&async_futex);
     403        futex_lock(&async_futex);
    404404
    405405        assert(!msg->forget);
     
    407407
    408408        if (msg->done) {
    409                 futex_up(&async_futex);
     409                futex_unlock(&async_futex);
    410410                goto done;
    411411        }
     
    443443
    444444        /* Leave the async_futex locked when entering this function */
    445         fibril_switch(FIBRIL_TO_MANAGER);
    446 
    447         /* Futex is up automatically after fibril_switch */
     445        fibril_switch(FIBRIL_FROM_BLOCKED);
     446        futex_unlock(&async_futex);
    448447
    449448        if (!msg->done)
     
    475474        assert(!msg->destroyed);
    476475
    477         futex_down(&async_futex);
     476        futex_lock(&async_futex);
    478477
    479478        if (msg->done) {
     
    484483        }
    485484
    486         futex_up(&async_futex);
     485        futex_unlock(&async_futex);
    487486}
    488487
     
    504503        tv_add_diff(&awaiter.to_event.expires, timeout);
    505504
    506         futex_down(&async_futex);
     505        futex_lock(&async_futex);
    507506
    508507        async_insert_timeout(&awaiter);
    509508
    510509        /* Leave the async_futex locked when entering this function */
    511         fibril_switch(FIBRIL_TO_MANAGER);
    512 
    513         /* Futex is up automatically after fibril_switch() */
     510        fibril_switch(FIBRIL_FROM_BLOCKED);
     511        futex_unlock(&async_futex);
    514512}
    515513
Note: See TracChangeset for help on using the changeset viewer.