Changeset 498ced1 in mainline for uspace/srv/hid/compositor/compositor.c
- Timestamp:
- 2018-08-11T02:43:32Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 05882233
- Parents:
- b13d80b
- git-author:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-11 02:29:02)
- git-committer:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-11 02:43:32)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/compositor/compositor.c
rb13d80b r498ced1 33 33 */ 34 34 35 #include <assert.h> 35 36 #include <stddef.h> 36 37 #include <stdint.h> … … 46 47 #include <stdlib.h> 47 48 48 #include < atomic.h>49 #include <refcount.h> 49 50 #include <fibril_synch.h> 50 51 #include <adt/prodcons.h> … … 93 94 typedef struct { 94 95 link_t link; 95 atomic_ t ref_cnt;96 atomic_refcount_t ref_cnt; 96 97 window_flags_t flags; 97 98 service_id_t in_dsid; … … 223 224 224 225 link_initialize(&win->link); 225 atomic_set(&win->ref_cnt, 0);226 refcount_init(&win->ref_cnt); 226 227 prodcons_initialize(&win->queue); 227 228 transform_identity(&win->transform); … … 240 241 static void window_destroy(window_t *win) 241 242 { 242 if ((win) && (atomic_get(&win->ref_cnt) == 0)) { 243 while (!list_empty(&win->queue.list)) { 244 window_event_t *event = (window_event_t *) list_first(&win->queue.list); 245 list_remove(&event->link); 246 free(event); 247 } 248 249 if (win->surface) 250 surface_destroy(win->surface); 251 252 free(win); 253 } 243 if (!win || !refcount_down(&win->ref_cnt)) 244 return; 245 246 while (!list_empty(&win->queue.list)) { 247 window_event_t *event = (window_event_t *) list_first(&win->queue.list); 248 list_remove(&event->link); 249 free(event); 250 } 251 252 if (win->surface) 253 surface_destroy(win->surface); 254 255 free(win); 254 256 } 255 257 … … 988 990 } 989 991 } 992 993 if (win) 994 refcount_up(&win->ref_cnt); 995 990 996 fibril_mutex_unlock(&window_list_mtx); 991 997 992 998 if (win) { 993 atomic_inc(&win->ref_cnt);994 999 async_answer_0(icall, EOK); 995 1000 } else { … … 1005 1010 if (!IPC_GET_IMETHOD(call)) { 1006 1011 async_answer_0(&call, EOK); 1007 atomic_dec(&win->ref_cnt);1008 1012 window_destroy(win); 1009 1013 return; … … 1024 1028 if (!IPC_GET_IMETHOD(call)) { 1025 1029 comp_window_close(win, &call); 1026 atomic_dec(&win->ref_cnt);1027 1030 window_destroy(win); 1028 1031 return;
Note:
See TracChangeset
for help on using the changeset viewer.