Changeset 508b0df1 in mainline for uspace/lib/graph/graph.c
- Timestamp:
- 2018-09-06T20:21:52Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 78de83de, fc10e1b
- Parents:
- 4621d23
- git-author:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-13 03:53:39)
- git-committer:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-09-06 20:21:52)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/graph/graph.c
r4621d23 r508b0df1 70 70 { 71 71 link_initialize(&vs->link); 72 atomic_ set(&vs->ref_cnt, 0);72 atomic_flag_clear(&vs->claimed); 73 73 vs->notif_sess = NULL; 74 74 fibril_mutex_initialize(&vs->mode_mtx); … … 83 83 // TODO 84 84 link_initialize(&rnd->link); 85 atomic_set(&rnd->ref_cnt, 0);85 refcount_init(&rnd->ref_cnt); 86 86 } 87 87 … … 173 173 } 174 174 175 if (rnd) 176 refcount_up(&rnd->ref_cnt); 177 175 178 fibril_mutex_unlock(&renderer_list_mtx); 176 179 … … 200 203 void graph_destroy_visualizer(visualizer_t *vs) 201 204 { 202 assert( atomic_get(&vs->ref_cnt) == 0);205 assert(!atomic_flag_test_and_set(&vs->claimed)); 203 206 assert(vs->notif_sess == NULL); 204 207 assert(!fibril_mutex_is_locked(&vs->mode_mtx)); … … 214 217 { 215 218 // TODO 216 assert(atomic_get(&rnd->ref_cnt) == 0); 217 218 free(rnd); 219 if (refcount_down(&rnd->ref_cnt)) 220 free(rnd); 219 221 } 220 222 … … 493 495 { 494 496 /* Claim the visualizer. */ 495 if ( !cas(&vs->ref_cnt, 0, 1)) {497 if (atomic_flag_test_and_set(&vs->claimed)) { 496 498 async_answer_0(icall, ELIMIT); 497 499 return; … … 559 561 async_hangup(vs->notif_sess); 560 562 vs->notif_sess = NULL; 561 atomic_ set(&vs->ref_cnt, 0);563 atomic_flag_clear(&vs->claimed); 562 564 } 563 565 … … 567 569 568 570 /* Accept the connection. */ 569 atomic_inc(&rnd->ref_cnt);570 571 async_answer_0(icall, EOK); 571 572 … … 588 589 589 590 terminate: 590 atomic_dec(&rnd->ref_cnt);591 graph_destroy_renderer(rnd); 591 592 } 592 593
Note:
See TracChangeset
for help on using the changeset viewer.