Changeset 3ede440 in mainline for uspace/lib/c/generic/thread/fibril_synch.c
- Timestamp:
- 2019-02-01T22:30:53Z (6 years ago)
- Parents:
- 1a37496
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-01 22:12:04)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-01 22:30:53)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/thread/fibril_synch.c
r1a37496 r3ede440 165 165 { 166 166 fm->oi.owned_by = NULL; 167 fm->counter = 1;167 fm->counter = 0; 168 168 list_initialize(&fm->waiters); 169 169 } … … 175 175 futex_lock(&fibril_synch_futex); 176 176 177 if (fm->counter-- > 0) { 177 fm->counter++; 178 179 if (fm->counter == 1) { 180 /* I am the only one here. */ 178 181 fm->oi.owned_by = f; 179 182 futex_unlock(&fibril_synch_futex); … … 196 199 197 200 futex_lock(&fibril_synch_futex); 198 if (fm->counter >0) {199 fm->counter --;201 if (fm->counter == 0) { 202 fm->counter++; 200 203 fm->oi.owned_by = (fibril_t *) fibril_get_id(); 201 204 locked = true; … … 209 212 { 210 213 assert(fm->oi.owned_by == (fibril_t *) fibril_get_id()); 211 212 if (fm->counter++ < 0) { 214 assert(fm->counter > 0); 215 216 fm->counter--; 217 218 if (fm->counter > 0) { 213 219 awaiter_t *wdp = list_pop(&fm->waiters, awaiter_t, link); 214 220 assert(wdp);
Note:
See TracChangeset
for help on using the changeset viewer.