Cancel io if task is deleted without being started

This prevent a deadlock on Windows since no process is actually running
until `Start()` is called.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2017-07-20 09:08:28 +02:00
parent 8e12d1fcad
commit 3df07cbc88
No known key found for this signature in database
GPG Key ID: 40CF16616B361216

View File

@ -188,6 +188,7 @@ func (t *task) Wait(ctx context.Context) (uint32, error) {
// during cleanup
func (t *task) Delete(ctx context.Context) (uint32, error) {
if t.io != nil {
t.io.Cancel()
t.io.Wait()
t.io.Close()
}