Skip to content
Newer
Older
100644 72 lines (48 sloc) 2.23 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 let opa = Scheduler.default
19
20 let push f = Scheduler.push opa f
21
22 let at_exit f = Scheduler.at_exit opa f
23
24 let asleep t f =
25 Scheduler.sleep opa (Time.milliseconds t) f
26
27 let sleep t f = ignore(asleep t f)
28
29 let timer t f = Scheduler.timer opa (Time.milliseconds t) f
30
31 let abort a = Scheduler.abort opa a
32
33
34 (* BSL REGISTERING *)
35 ##register sleep : int, (-> void) -> void
36
37 ##register [cps-bypass] sleep_cps : int, (continuation(opa[void]) -> void), continuation(opa[void]) -> void
38 let sleep_cps t f k =
39 sleep t (BslUtils.proj_cps0 k f);
40 QmlCpsServerLib.return k ServerLib.void
41
42
43 ##register timer : int, (-> void) -> void
44
45 ##register [cps-bypass] timer_cps : int, (continuation(opa[void]) -> void), continuation(opa[void]) -> void
46 let timer_cps t f k =
47 timer t (BslUtils.proj_cps0 k f);
48 QmlCpsServerLib.return k ServerLib.void
49
50
51 ##register push : (-> void) -> void
52
53 ##register [cps-bypass] push_cps : (continuation(opa[void]) -> void), continuation(opa[void]) -> void
54 let push_cps f k =
55 push (BslUtils.proj_cps0 k f);
56 QmlCpsServerLib.return k ServerLib.void
57
58 ##register at_exit : (-> void) -> void
59
60 ##register [cps-bypass] at_exit_cps : (continuation(opa[void]) -> void), continuation(opa[void]) -> void
61 let at_exit_cps f k =
62 at_exit (BslUtils.proj_cps0 k f);
63 QmlCpsServerLib.return k ServerLib.void
64
65 ##register finalize : ('a -> void), 'a -> void
66 let finalize f v = Scheduler.finalise opa f v
67
68 ##register [cps-bypass] finalize_cps : (opa['a], continuation(opa[void]) -> void), opa['a], continuation(opa[void]) -> void
69 let finalize_cps f v k =
70 finalize (BslUtils.proj_cps k f) v;
71 QmlCpsServerLib.return k ServerLib.void
Something went wrong with that request. Please try again.