Remove use of pthread_cancel in the swapchain page flip thread

The WSI layer may call pthread_cancel and kill the page flip
thread while it's still being used in Vulkan-API calls. This can cause the
layer to fail to clean up internal resources of the associated device,
leading to memory leaks. To resolve this, the layer now instead checks
if the page flip thread needs to end on every loop iteration. The
m_page_flip_semaphore has also been changed to a timed_semaphore to avoid
hanging indefinitely. In addition, m_page_flip_thread is now type
std::thread, which follows the gradual move towards C++ standard code.

Change-Id: Iefbdd0d68e1f92fdf79bcebb7eaf33429fc61fd3
Signed-off-by: Dennis Tsiang <>
1 job for remove-pthread-cancel in 1 minute and 36 seconds (queued for 2 seconds)
Status Job ID Name Coverage
passed #2471908