Changeset 5ee5f67 in mainline
- Timestamp:
- 2024-12-28T20:03:35Z (5 months ago)
- Children:
- 723f1d9
- Parents:
- 083ce33
- git-author:
- Miroslav Cimerman <mc@…> (2024-12-28 19:52:30)
- git-committer:
- Miroslav Cimerman <mc@…> (2024-12-28 20:03:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/fge.c
r083ce33 r5ee5f67 106 106 size_t own_used; 107 107 errno_t final_errno; 108 atomic_size_t finished_okay; 109 atomic_size_t finished_fail; 110 atomic_size_t wus_started; 108 size_t finished_okay; 109 size_t finished_fail; 111 110 fibril_mutex_t lock; 112 111 fibril_condvar_t all_done; … … 235 234 result->finished_okay = 0; 236 235 result->finished_fail = 0; 237 result->wus_started = 0;238 236 239 237 fibril_mutex_initialize(&result->lock); … … 281 279 { 282 280 fibril_mutex_lock(&group->lock); 283 assert(group->submitted + 1 <=group->wu_cnt);281 assert(group->submitted < group->wu_cnt); 284 282 285 283 fge_fibril_data_t executor; … … 301 299 errno_t hr_fgroup_wait(hr_fgroup_t *group, size_t *rokay, size_t *rfailed) 302 300 { 301 assert(group->submitted == group->wu_cnt); 302 303 303 fibril_mutex_lock(&group->lock); 304 304 while (true) { 305 305 size_t finished = group->finished_fail + group->finished_okay; 306 if (group->wu s_started != 0 && group->wus_started== finished)306 if (group->wu_cnt == finished) 307 307 break; 308 308 … … 316 316 317 317 errno_t rc = EOK; 318 if (group->finished_okay != group->wu s_started)318 if (group->finished_okay != group->wu_cnt) 319 319 rc = EIO; 320 320 … … 382 382 hr_fgroup_t *group = executor.group; 383 383 384 atomic_fetch_add_explicit(&group->wus_started, 1,385 memory_order_relaxed);386 387 384 errno_t rc = executor.wu(executor.arg); 388 385 389 if (rc == EOK) 390 atomic_fetch_add_explicit(&group->finished_okay, 1, 391 memory_order_relaxed); 392 else 393 atomic_fetch_add_explicit(&group->finished_fail, 1, 394 memory_order_relaxed); 386 if (rc == EOK) { 387 fibril_mutex_lock(&group->lock); 388 group->finished_okay++; 389 fibril_mutex_unlock(&group->lock); 390 } else { 391 fibril_mutex_lock(&group->lock); 392 group->finished_fail++; 393 fibril_mutex_unlock(&group->lock); 394 } 395 395 396 396 fibril_mutex_lock(&pool->lock); … … 400 400 } 401 401 402 size_t group_total_done = group->finished_fail + 403 group->finished_okay; 404 if (group->wus_started == group_total_done) 402 fibril_mutex_lock(&group->lock); 403 size_t finished = group->finished_fail + group->finished_okay; 404 fibril_mutex_unlock(&group->lock); 405 if (finished == group->wu_cnt) 405 406 fibril_condvar_signal(&group->all_done); 406 407
Note:
See TracChangeset
for help on using the changeset viewer.