Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 39 lines (30 sloc) 1.604 kb
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18
19 let write_timeout () =
20 let _ = Unix.putenv "MLSTATE_SHOW_LOGS" "1" in
21 let scheduler = Scheduler.make () in
22 (* let conn_out = Scheduler.make_connection scheduler (Scheduler.File Unix.stdout) in *)
23 let conn_in = Scheduler.make_connection scheduler (Scheduler.File Unix.stdin) in
24 let block_size = 6 in
25 (* WRITE TEST *)
26 let count = ref 4000000 in
27 Scheduler.write scheduler conn_in ~timeout:1. ~block_size "official message 1\n" ~err_cont:(fun e -> print_string "time's over! 1\n" ; flush stdout;) (fun i -> print_string "normal cont 1\n"; flush stdout; ) ;
28 Scheduler.write scheduler conn_in ~timeout:0.00001 ~block_size "official message 2\n" ~err_cont:(fun e -> print_string "time's over! 2\n" ; flush stdout;) (fun i -> print_string "normal cont 2\n"; flush stdout; ) ;
29 while (!count > 0) do
30 Scheduler.wait scheduler ~block:false ;
31 count := !count - 1;
32 flush stdout;
33 done
34
35
36 let _ =
37 write_timeout ();
38
Something went wrong with that request. Please try again.