1 #include <unistd.h>
2
3 #include "Cello.h"
4
main(int argc,char ** argv)5 int main(int argc, char** argv) {
6
7 var mut = new(Mutex);
8
9 lambda(thread_function, args) {
10 with(m in mut) {
11 println("Hello from %$! with Arguments %$", current(Thread), args);
12 }
13 return None;
14 };
15
16 var threads = new(List,
17 new(Thread, thread_function),
18 new(Thread, thread_function),
19 new(Thread, thread_function),
20 new(Thread, thread_function),
21 new(Thread, thread_function));
22
23 foreach(t in threads) {
24 call(t);
25 }
26
27 foreach(t in threads) {
28 join(t);
29 delete(t);
30 }
31
32 delete(threads);
33 delete(mut);
34
35 return 0;
36
37 }
38