Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fake.Core.Process: stop using old ref-cell operators #2674

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/app/Fake.Core.Process/InternalStreams.fs
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ module internal InternalStreams =
let asyncResult = ref null
Async.FromBeginEnd(
(fun (callback, state) ->
asyncResult := beginAction(callback, state)
!asyncResult),
asyncResult.Value <- beginAction(callback, state)
asyncResult.Value),
(fun res ->
endAction res),
cancelAction = (fun () ->
while !asyncResult = null do Thread.Sleep 20
cancelAction(!asyncResult)))
while asyncResult.Value = null do Thread.Sleep 20
cancelAction(asyncResult.Value)))
open AsyncHelper

type ConcurrentQueueMessage<'a> =
Expand Down Expand Up @@ -232,12 +232,12 @@ module internal InternalStreams =
while not cts.IsCancellationRequested do
let! data = innerStream.Read()
let finished = ref false
while not !finished do
while not finished.Value do
let! (asyncResult:MyIAsyncReadResult<'a>) = queue.DequeAsync()
if not asyncResult.IsCanceled then
try
asyncResult.End(data)
finished := true
finished.Value <- true
with ReadCanceledException -> () // find next
return ()
}, cancellationToken = workerCts.Token)
Expand Down Expand Up @@ -466,7 +466,7 @@ module internal InternalStreams =
//let raw = infiniteStream()
let readFinished = ref false
let read () =
if !readFinished then
if readFinished.Value then
async.Return None
else
async {
Expand All @@ -477,16 +477,16 @@ module internal InternalStreams =
match s with
| Some d -> Some d
| None ->
readFinished := true
readFinished.Value <- true
None
| None ->
failwith "stream should not be limited as we are using an infiniteStream!" }
let isFinished = ref false
let finish () = async {
do! raw.Write None
isFinished := true }
isFinished.Value <- true }
let write item =
if !isFinished then
if isFinished.Value then
failwith "stream is in finished state so it should not be written to!"
raw.Write (Some item)
finish,
Expand Down