[waffle] [PATCH v2 2/3] wcore: rework non-compatible mutex initialization

Emil Velikov emil.l.velikov at gmail.com
Wed Mar 25 07:30:00 PDT 2015


On 24 March 2015 at 17:37, Jose Fonseca <jfonseca at vmware.com> wrote:
> Is wcore_display_teardown called only once, or when destroying each display?
>
> If the latter, then it's not safe to call `mtx_destroy(&mutex)` on
> `wcore_display_teardown`.  Otherwise when  wcore_display_init is called
> next, wcore_display_init_once() will not be called a 2nd time, hence mutex
> will stay invalid.
>
>
> This should probably done at waffle_teardown.
>
> BTW, if the mutex was initialized at waffle_init, then once_flag wouldn't
> even be necessary.
>
Indeed you're bang on the spot. id_counter should be locked throughout
a series of display_{connect, disconnect}, thus we should push
mtx_{init,destroy} up to waffle_{init,teardown}. What worries me is
that none of the tests (ran in valgrind) point out any issues.

Might be worth looking into, once I've got waffle_teardown() hooked in there.

-Emil


More information about the waffle mailing list