aboutsummaryrefslogtreecommitdiff
path: root/trunk/ivyLoop.ml
blob: 5808de40a2238c5873e4f066cd5a27894197bb93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
type channel
type delete_channel_cb = unit -> unit
type timer
type timer_cb = timer -> unit

external ext_timer : int -> int -> string -> timer = "ivy_timerRepeatafter"

let timer = fun n t cb ->
  let closure_name = Ivy.cb_register cb in
  ext_timer n t closure_name

external remove_timer : timer -> unit = "ivy_timerRemove"

external main : unit -> unit = "ivy_mainLoop"

external ext_channelSetUp : Unix.file_descr -> string -> channel = "ivy_channelSetUp"
external close_channel : channel -> unit = "ivy_channelClose"


type read_channel_cb = channel -> unit
let set_up_channel fd delete read =
  ext_channelSetUp fd (Ivy.cb_register read)