libxl: Add optimisation to ev_lock
authorAnthony PERARD <anthony.perard@citrix.com>
Fri, 7 Jun 2019 14:19:02 +0000 (15:19 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Thu, 19 Sep 2019 11:24:56 +0000 (12:24 +0100)
commit5e2d477993fd9f759b87ed6391be52a3638a02dc
treef68316af88404fc573f9029f976aef70cc684b45
parent79964e941364c17968fea7a44a37dff2c77c01da
libxl: Add optimisation to ev_lock

It will often be the case that the lock is free to grab. So we first
try to grab it before we have to fork. Even though in this case the
locks are grabbed in the wrong order in the lock hierarchy (ev_lock
should be outside of CTX_LOCK), it is fine to try without blocking. If
that failed, we will release CTX_LOCK and try to grab both lock again
in the right order.

That optimisation is only enabled in releases (debug=n) so the more
complicated code with fork is actually exercised.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/Makefile
tools/libxl/libxl_internal.c