meganz / mingw-std-threads

Standard threads implementation currently still missing on MinGW GCC on Windows
BSD 2-Clause "Simplified" License
439 stars 137 forks source link

Prevent `async` from blocking `future::wait_for` #77

Closed nmcclatchey closed 3 years ago

nmcclatchey commented 3 years ago

Fixes a bug in mingw.future.h by removing locking during calculation of asynchronous functions. This prevents future's wait_for routine from locking until the asynchronous task completes by moving the update lock (part of a mechanism for alerting waiters) to after the asynchronous function's computation is complete. After the patch, behavior is as expected, with requests timing out at approximately the requested time.