Changeset 58775d30 in mainline for uspace/lib/c/generic/fibril.c
- Timestamp:
- 2015-03-16T16:07:21Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2003739
- Parents:
- 6069061 (diff), 795e2bf (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/fibril.c
r6069061 r58775d30 49 49 #include <assert.h> 50 50 #include <async.h> 51 #include <futex.h> 52 53 #ifdef FUTEX_UPGRADABLE 54 #include <rcu.h> 55 #endif 51 56 52 57 /** … … 54 59 * serialized_list and manager_list. 55 60 */ 56 static atomic_t fibril_futex = FUTEX_INITIALIZER;61 static futex_t fibril_futex = FUTEX_INITIALIZER; 57 62 58 63 static LIST_INITIALIZE(ready_list); … … 83 88 { 84 89 fibril_t *fibril = __tcb_get()->fibril_data; 90 91 #ifdef FUTEX_UPGRADABLE 92 rcu_register_fibril(); 93 #endif 85 94 86 95 /* Call the implementing function. */ … … 146 155 int retval = 0; 147 156 148 futex_ down(&fibril_futex);157 futex_lock(&fibril_futex); 149 158 150 159 if (stype == FIBRIL_PREEMPT && list_empty(&ready_list)) … … 168 177 if ((stype == FIBRIL_TO_MANAGER) || (stype == FIBRIL_FROM_DEAD)) { 169 178 while (list_empty(&manager_list)) { 170 futex_u p(&fibril_futex);179 futex_unlock(&fibril_futex); 171 180 async_create_manager(); 172 futex_ down(&fibril_futex);181 futex_lock(&fibril_futex); 173 182 } 174 183 } … … 203 212 } 204 213 205 return 1; /* futex_u palready done here */214 return 1; /* futex_unlock already done here */ 206 215 } 207 216 … … 246 255 list_remove(&dstf->link); 247 256 248 futex_up(&fibril_futex); 257 futex_unlock(&fibril_futex); 258 259 #ifdef FUTEX_UPGRADABLE 260 if (stype == FIBRIL_FROM_DEAD) { 261 rcu_deregister_fibril(); 262 } 263 #endif 264 249 265 context_restore(&dstf->ctx); 250 266 /* not reached */ 251 267 252 268 ret_0: 253 futex_u p(&fibril_futex);269 futex_unlock(&fibril_futex); 254 270 return retval; 255 271 } … … 318 334 fibril_t *fibril = (fibril_t *) fid; 319 335 320 futex_ down(&fibril_futex);336 futex_lock(&fibril_futex); 321 337 322 338 if ((fibril->flags & FIBRIL_SERIALIZED)) … … 325 341 list_append(&fibril->link, &ready_list); 326 342 327 futex_u p(&fibril_futex);343 futex_unlock(&fibril_futex); 328 344 } 329 345 … … 338 354 fibril_t *fibril = (fibril_t *) fid; 339 355 340 futex_ down(&fibril_futex);356 futex_lock(&fibril_futex); 341 357 list_append(&fibril->link, &manager_list); 342 futex_u p(&fibril_futex);358 futex_unlock(&fibril_futex); 343 359 } 344 360 … … 346 362 void fibril_remove_manager(void) 347 363 { 348 futex_ down(&fibril_futex);364 futex_lock(&fibril_futex); 349 365 350 366 if (!list_empty(&manager_list)) 351 367 list_remove(list_first(&manager_list)); 352 368 353 futex_u p(&fibril_futex);369 futex_unlock(&fibril_futex); 354 370 } 355 371
Note:
See TracChangeset
for help on using the changeset viewer.