Skip to content
  • Aron Rosenberg's avatar
    Fix semaphore emulation on Windows · eeb81173
    Aron Rosenberg authored
    The existing emulation of posix semaphores on Windows uses SetEvent()
    and WaitForSingleObject(), which implements a binary semaphore, not a
    counting semaphore as implemented by posix. This causes deadlock when
    used with the expected posix semantics. Instead, this patch uses the
    CreateSemaphore() and ReleaseSemaphore() calls (introduced in Windows
    2000) which have the expected behavior.
    
    This patch also reverts commit eb16f00c, which split a semaphore that
    was being used with counting semantics into two binary semaphores.
    That commit is unnecessary with corrected emulation.
    
    Change-Id: If400771536a27af4b0c3a31aa4c4e9ced89ce6a0
    eeb81173