Changeset b69bec5 in mainline
- Timestamp:
- 2009-10-11T10:48:56Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bbb01b98
- Parents:
- 854ad23
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/fibril_sync.c
r854ad23 rb69bec5 129 129 if (frw->writers) { 130 130 fibril_t *f = (fibril_t *) fibril_get_id(); 131 awaiter_t wdata; 132 133 wdata.fid = (fid_t) f; 134 wdata.active = false; 135 wdata.wu_event.inlist = true; 136 link_initialize(&wdata.wu_event.link); 131 137 f->flags &= ~FIBRIL_WRITER; 132 list_append(& f->link, &frw->waiters);138 list_append(&wdata.wu_event.link, &frw->waiters); 133 139 fibril_switch(FIBRIL_TO_MANAGER); 134 140 } else { … … 143 149 if (frw->writers || frw->readers) { 144 150 fibril_t *f = (fibril_t *) fibril_get_id(); 151 awaiter_t wdata; 152 153 wdata.fid = (fid_t) f; 154 wdata.active = false; 155 wdata.wu_event.inlist = true; 156 link_initialize(&wdata.wu_event.link); 145 157 f->flags |= FIBRIL_WRITER; 146 list_append(& f->link, &frw->waiters);158 list_append(&wdata.wu_event.link, &frw->waiters); 147 159 fibril_switch(FIBRIL_TO_MANAGER); 148 160 } else { … … 167 179 while (!list_empty(&frw->waiters)) { 168 180 link_t *tmp = frw->waiters.next; 169 fibril_t *f = list_get_instance(tmp, fibril_t, link); 181 awaiter_t *wdp; 182 fibril_t *f; 183 184 wdp = list_get_instance(tmp, awaiter_t, wu_event.link); 185 f = (fibril_t *) wdp->fid; 170 186 171 187 if (f->flags & FIBRIL_WRITER) { 172 188 if (frw->readers) 173 189 break; 174 list_remove(&f->link); 175 fibril_add_ready((fid_t) f); 190 wdp->active = true; 191 wdp->wu_event.inlist = false; 192 list_remove(&wdp->wu_event.link); 193 fibril_add_ready(wdp->fid); 176 194 frw->writers++; 177 195 optimize_execution_power(); 178 196 break; 179 197 } else { 180 list_remove(&f->link); 181 fibril_add_ready((fid_t) f); 198 wdp->active = true; 199 wdp->wu_event.inlist = false; 200 list_remove(&wdp->wu_event.link); 201 fibril_add_ready(wdp->fid); 182 202 frw->readers++; 183 203 optimize_execution_power();
Note:
See TracChangeset
for help on using the changeset viewer.