On 07/05/2014 09:46 PM, Wolf Ramovsky wrote: > It seems that window_destroy() doesn't touch window_list. But > nevertheless thank you, I didn't checked it before your question.
Neither does window_create(). Which brings me to the idea to move the locking of the mutex just before the window is inserted into the window list instead of adding mutex_unlock() to all error paths. What do you think? Otherwise, if you decide not to move mutex_lock() down, it still seems to me good to preserve certain symetry between window_create(), window_destroy() and mutex_lock() and mutex_unlock(). Jakub > > 2014-07-05 23:08 GMT+04:00, Jakub Jermar <[email protected]>: >> On 07/04/2014 09:00 PM, Wolf Ramovsky wrote: >>> === modified file 'uspace/srv/hid/compositor/compositor.c' >>> --- uspace/srv/hid/compositor/compositor.c 2014-03-01 23:05:38 +0000 >>> +++ uspace/srv/hid/compositor/compositor.c 2014-07-04 18:58:58 +0000 >>> @@ -891,6 +891,7 @@ >>> >>> window_t *win = window_create(); >>> if (!win) { >>> + fibril_mutex_unlock(&window_list_mtx); >>> async_answer_2(callid, ENOMEM, 0, 0); >>> return; >>> } >>> @@ -906,12 +907,14 @@ >>> ++window_id; >>> >>> if (loc_service_register(name_in, &win->in_dsid) != >>> EOK) { >>> + fibril_mutex_unlock(&window_list_mtx); >>> window_destroy(win); >>> async_answer_2(callid, EINVAL, 0, 0); >>> return; >>> } >>> >>> if (loc_service_register(name_out, &win->out_dsid) != >>> EOK) { >>> + fibril_mutex_unlock(&window_list_mtx); >>> loc_service_unregister(win->in_dsid); >>> window_destroy(win); >>> async_answer_2(callid, EINVAL, 0, 0); >> >> >> Should not the mutex be unlocked only after the window is destroyed? >> >> Jakub >> >> _______________________________________________ >> HelenOS-devel mailing list >> [email protected] >> http://lists.modry.cz/listinfo/helenos-devel >> > > _______________________________________________ > HelenOS-devel mailing list > [email protected] > http://lists.modry.cz/listinfo/helenos-devel > _______________________________________________ HelenOS-devel mailing list [email protected] http://lists.modry.cz/listinfo/helenos-devel
