Changeset 47c9a8c in mainline for uspace/lib/c/generic/fibril_synch.c


Ignore:
Timestamp:
2012-04-13T20:21:32Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ab9f443
Parents:
87608a5
Message:

Small improvements in the async framework.

  • Provide functions for initialization of amsg_t and awaiter_t.
  • Add async_forget() to mark messages that can be discarded right on their arrival because the recipient is no longer interested in the reply.
  • Add a couple of asserts to make sure that the async_wait_for(), async_wait_timeout() and async_forget() are not used inappropriately.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/fibril_synch.c

    r87608a5 r47c9a8c  
    112112                awaiter_t wdata;
    113113
     114                awaiter_initialize(&wdata);
    114115                wdata.fid = fibril_get_id();
    115                 wdata.active = false;
    116116                wdata.wu_event.inlist = true;
    117                 link_initialize(&wdata.wu_event.link);
    118117                list_append(&wdata.wu_event.link, &fm->waiters);
    119118                check_for_deadlock(&fm->oi);
     
    205204                awaiter_t wdata;
    206205
     206                awaiter_initialize(&wdata);
    207207                wdata.fid = (fid_t) f;
    208                 wdata.active = false;
    209208                wdata.wu_event.inlist = true;
    210                 link_initialize(&wdata.wu_event.link);
    211209                f->flags &= ~FIBRIL_WRITER;
    212210                list_append(&wdata.wu_event.link, &frw->waiters);
     
    233231                awaiter_t wdata;
    234232
     233                awaiter_initialize(&wdata);
    235234                wdata.fid = (fid_t) f;
    236                 wdata.active = false;
    237235                wdata.wu_event.inlist = true;
    238                 link_initialize(&wdata.wu_event.link);
    239236                f->flags |= FIBRIL_WRITER;
    240237                list_append(&wdata.wu_event.link, &frw->waiters);
     
    375372                return ETIMEOUT;
    376373
     374        awaiter_initialize(&wdata);
    377375        wdata.fid = fibril_get_id();
    378         wdata.active = false;
    379        
    380376        wdata.to_event.inlist = timeout > 0;
    381         wdata.to_event.occurred = false;
    382         link_initialize(&wdata.to_event.link);
    383 
    384377        wdata.wu_event.inlist = true;
    385         link_initialize(&wdata.wu_event.link);
    386378
    387379        futex_down(&async_futex);
Note: See TracChangeset for help on using the changeset viewer.