@background

Sat, 28 Dec 2019 10:14:02 +0200

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sat, 28 Dec 2019 10:14:02 +0200
changeset 9
59d94d475b5a
parent 8
44ac3683263c
child 10
e9edf00242a3

@background

src/Util.jl file | annotate | diff | comparison | revisions
--- a/src/Util.jl	Sat Dec 28 02:08:30 2019 +0200
+++ b/src/Util.jl	Sat Dec 28 10:14:02 2019 +0200
@@ -24,7 +24,8 @@
        proj_norm₂₁ball!,
        curry,
        ⬿,
-       @threadsif
+       @threadsif,
+       @background
 
 
 ##########
@@ -39,6 +40,12 @@
                  end))
 end
 
+macro background(bgtask, fgtask)
+    return :(t = Threads.@spawn $(esc(bgtask));
+             $(esc(fgtask));
+             wait(t))
+end
+
 ########################
 # Functional programming
 #########################

mercurial