1999-12-23 09:33:59 -08:00
|
|
|
let yield = ref false
|
|
|
|
|
1996-04-02 00:41:32 -08:00
|
|
|
let print_message c =
|
|
|
|
for i = 1 to 10000 do
|
1999-12-23 09:33:59 -08:00
|
|
|
print_char c; flush stdout;
|
|
|
|
if !yield then Thread.yield()
|
1996-04-02 00:41:32 -08:00
|
|
|
done
|
|
|
|
|
2000-04-17 13:01:40 -07:00
|
|
|
let _ = yield := (Array.length Sys.argv > 1)
|
|
|
|
let t1 = Thread.create print_message 'a'
|
|
|
|
let t2 = Thread.create print_message 'b'
|
|
|
|
let _ = Thread.join t1
|
|
|
|
let _ = Thread.join t2
|
|
|
|
|
|
|
|
;;
|