• Patrick Mezard's avatar
    os: fix a race between Process.signal() and wait() on Windows · d574b59f
    Patrick Mezard authored
    Process.handle was accessed without synchronization while wait() and
    signal() could be called concurrently.
    
    A first solution was to add a Mutex in Process but it was probably too
    invasive given Process.handle is only used on Windows.
    
    This version uses atomic operations to read the handle value. There is
    still a race between isDone() and the value of the handle, but it only
    leads to slightly incorrect error codes. The caller may get a:
    
      errors.New("os: process already finished")
    
    instead of:
    
      syscall.EINVAL
    
    which sounds harmless.
    
    Fixes #9382
    
    Change-Id: Iefcc687a1166d5961c8f27154647b9b15a0f748a
    Reviewed-on: https://go-review.googlesource.com/9904Reviewed-by: 's avatarAlex Brainman <alex.brainman@gmail.com>
    Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    d574b59f
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...