File: simple_threads.ml

package info (click to toggle)
findlib 1.9.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,864 kB
  • sloc: ml: 7,800; xml: 3,138; sh: 1,605; makefile: 427
file content (17 lines) | stat: -rw-r--r-- 254 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
let tl =
  List.map
    (fun _ ->
      Thread.create 
        (fun () ->
           for i = 1 to 1000 do
              let _ = 1+1 in ()
           done)
        ())
    [ (); (); (); (); () ]
  in

  List.iter Thread.join tl
;;

print_string "OK\n";;