summaryrefslogtreecommitdiff
path: root/lib/thread/do.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/thread/do.myr')
-rw-r--r--lib/thread/do.myr17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/thread/do.myr b/lib/thread/do.myr
new file mode 100644
index 0000000..3a4449f
--- /dev/null
+++ b/lib/thread/do.myr
@@ -0,0 +1,17 @@
+use std
+
+use "future"
+use "spawn"
+
+pkg thread =
+ generic do : (fn : (-> @a) -> future(@a)#)
+;;
+
+generic do = {fn
+ var r
+
+ r = mkfut()
+ spawn({; futput(r, fn()) })
+ -> r
+}
+