Skip to content

Instantly share code, notes, and snippets.

@AlexCuse
Created June 30, 2011 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexCuse/1056072 to your computer and use it in GitHub Desktop.
Save AlexCuse/1056072 to your computer and use it in GitHub Desktop.
subscriber usage
let Run<'T when 'T: not struct and 'T:null and 'T:equality> (errorCallback, ct:CancellationToken, finished:ManualResetEvent) =
let sub = new Subscriber<'T>()
sub.ReceivedMessages(ct)
|> Seq.iter (fun msg ->
try
write msg
with | ex ->
sub.Return msg
errorCallback ex)
finished.Set() |> ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment