Last active
August 29, 2015 14:17
-
-
Save Porges/b9a318bc1f98dd16184a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open System | |
| open System.Threading | |
| type OnceLazy (action : unit -> unit) = | |
| let it = Lazy(action, LazyThreadSafetyMode.ExecutionAndPublication) | |
| member this.Force() = it.Force() | |
| type Once (action : unit -> unit) = | |
| let mutable performed = 0 | |
| member this.Force() = | |
| if Interlocked.CompareExchange(&performed, 1, 0) = 0 | |
| then action() | |
| let main = | |
| let o = Once(fun () -> printfn "hello!") | |
| o.Force() | |
| o.Force() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Open ....n type xnxx its works ...Really