8:44ac3683263c | 9:59d94d475b5a |
---|---|
22 dot, | 22 dot, |
23 mean, | 23 mean, |
24 proj_norm₂₁ball!, | 24 proj_norm₂₁ball!, |
25 curry, | 25 curry, |
26 ⬿, | 26 ⬿, |
27 @threadsif | 27 @threadsif, |
28 @background | |
28 | 29 |
29 | 30 |
30 ########## | 31 ########## |
31 # Threads | 32 # Threads |
32 ########## | 33 ########## |
35 return esc(:(if $threads | 36 return esc(:(if $threads |
36 Threads.@threads $loop | 37 Threads.@threads $loop |
37 else | 38 else |
38 $loop | 39 $loop |
39 end)) | 40 end)) |
41 end | |
42 | |
43 macro background(bgtask, fgtask) | |
44 return :(t = Threads.@spawn $(esc(bgtask)); | |
45 $(esc(fgtask)); | |
46 wait(t)) | |
40 end | 47 end |
41 | 48 |
42 ######################## | 49 ######################## |
43 # Functional programming | 50 # Functional programming |
44 ######################### | 51 ######################### |