Ignore:
File:
1 edited

Legend:

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

    r9414abc r55bd76c  
    180180void fibril_rwlock_read_lock(fibril_rwlock_t *frw)
    181181{
    182         fibril_t *f = (fibril_t *) fibril_get_id();
    183        
    184182        futex_down(&async_futex);
    185183        if (frw->writers) {
     184                fibril_t *f = (fibril_t *) fibril_get_id();
    186185                awaiter_t wdata;
    187186
     
    196195                fibril_switch(FIBRIL_TO_MANAGER);
    197196        } else {
    198                 /* Consider the first reader the owner. */
    199                 if (frw->readers++ == 0)
    200                         frw->oi.owned_by = f;
     197                frw->readers++;
    201198                futex_up(&async_futex);
    202199        }
     
    232229        assert(frw->readers || (frw->writers == 1));
    233230        if (frw->readers) {
    234                 if (--frw->readers) {
    235                         if (frw->oi.owned_by == (fibril_t *) fibril_get_id()) {
    236                                 /*
    237                                  * If this reader firbril was considered the
    238                                  * owner of this rwlock, clear the ownership
    239                                  * information even if there are still more
    240                                  * readers.
    241                                  *
    242                                  * This is the limitation of the detection
    243                                  * mechanism rooted in the fact that tracking
    244                                  * all readers would require dynamically
    245                                  * allocated memory for keeping linkage info.
    246                                  */
    247                                 frw->oi.owned_by = NULL;
    248                         }
     231                if (--frw->readers)
    249232                        goto out;
    250                 }
    251233        } else {
    252234                frw->writers--;
     
    283265                        list_remove(&wdp->wu_event.link);
    284266                        fibril_add_ready(wdp->fid);
    285                         if (frw->readers++ == 0) {
    286                                 /* Consider the first reader the owner. */
    287                                 frw->oi.owned_by = f;
    288                         }
     267                        frw->readers++;
    289268                        optimize_execution_power();
    290269                }
Note: See TracChangeset for help on using the changeset viewer.