summaryrefslogtreecommitdiff
path: root/lib/thread/do.myr
blob: 3a4449f36b7f679efe1f47907582664bc1d78af5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
}