<commit_before>
let xe = Eventchn.init ()
let nr_events = 1024
let event_cb = Array.init nr_events (fun _ -> Lwt_sequence.create ())

let wait port =
  let th, u = Lwt.task () in
  let node = Lwt_sequence.add_r u event_cb.(Eventchn.to_int port) in
  Lwt.on_cancel th (fun _ -> Lwt_sequence.remove node);
  th

let wake port =
	Lwt_sequence.iter_node_l (fun node ->
		let u = Lwt_sequence.get node in
		Lwt_sequence.remove node;
		Lwt.wakeup u ()
    ) event_cb.(port)

(* Go through the event mask and activate any events, potentially spawning
   new threads *)
let run () =
	let fd = Lwt_unix.of_unix_file_descr ~blocking:false ~set_flags:true (Eventchn.fd xe) in
	let rec inner () =
		lwt () = Lwt_unix.wait_read fd in
	    let port = Eventchn.pending xe in
		wake (Eventchn.to_int port);
		Eventchn.unmask xe port;
        inner ()
   in inner ()<commit_msg>Remove the top-level binding which called Eventchn.init<commit_after>
let nr_events = 1024
let event_cb = Array.init nr_events (fun _ -> Lwt_sequence.create ())

let wait port =
  let th, u = Lwt.task () in
  let node = Lwt_sequence.add_r u event_cb.(Eventchn.to_int port) in
  Lwt.on_cancel th (fun _ -> Lwt_sequence.remove node);
  th

let wake port =
	Lwt_sequence.iter_node_l (fun node ->
		let u = Lwt_sequence.get node in
		Lwt_sequence.remove node;
		Lwt.wakeup u ()
    ) event_cb.(port)

(* Go through the event mask and activate any events, potentially spawning
   new threads *)
let run () =
	let xe = Eventchn.init () in
	let fd = Lwt_unix.of_unix_file_descr ~blocking:false ~set_flags:true (Eventchn.fd xe) in
	let rec inner () =
		lwt () = Lwt_unix.wait_read fd in
	    let port = Eventchn.pending xe in
		wake (Eventchn.to_int port);
		Eventchn.unmask xe port;
        inner ()
   in inner ()
{'fraction_non_alphanumeric': 0.10067873303167421, 'fraction_numerical': 0.004524886877828055, 'mean_word_length': 3.4114713216957604, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5856680', 'n_tokens_mistral': 668, 'n_tokens_neox': 639, 'n_words': 195}