Skip to content

Commit

Permalink
Merge pull request #50 from ThoughtWorksInc/simplify
Browse files Browse the repository at this point in the history
Simplify toHostBuffer implementation
  • Loading branch information
Atry committed Feb 11, 2018
2 parents 35f8287 + 99d0cec commit 6baefba
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions OpenCL/src/main/scala/com/thoughtworks/compute/OpenCL.scala
Expand Up @@ -615,11 +615,10 @@ object OpenCL {
Resource(value = Success(hostBuffer), release = UnitContinuation.delay { memory.free(hostBuffer) })
}))).flatMap { hostBuffer =>
enqueueReadBuffer[memory.HostBuffer](hostBuffer, preconditionEvents: _*)(witnessOwner, memory)
.flatMap { event =>
Do.garbageCollected(event.waitForComplete())
}
.intransitiveMap { _: Unit =>
hostBuffer
.intransitiveFlatMap { event =>
Do.garbageCollected(event.waitForComplete()).map { _: Unit =>
hostBuffer
}
}
}
}
Expand Down

0 comments on commit 6baefba

Please sign in to comment.