Browse Source

Code cleaning

Leo 9 years ago
parent
commit
07bfb615ba
3 changed files with 7 additions and 2 deletions
  1. 5 1
      src/default.ml
  2. 1 0
      src/lock.ml
  3. 1 1
      src/messages.ml

+ 5 - 1
src/default.ml

@@ -42,9 +42,13 @@ open Core.Std;;
 (* cmd_number is the number of the command the user wants
  * to execute *)
 let run ~rc cmd_number =
+
   (* Wait for another oclaunch instance which could launch the same program at
-   * the same time *)
+   * the same time and then lock *)
+  Messages.debug "Waiting for locker";
   Lock.wait ();
+  Messages.debug "Locked";
+
   let tmp = Tmp_file.init () in
   match cmd_number with
     | None -> begin

+ 1 - 0
src/lock.ml

@@ -49,6 +49,7 @@ let lock () =
 ;;
 
 (* Pause the program until lock file is removed, until argument is in second *)
+(* TODO Implement recursion *)
 let rec wait ?(until=10) ?(delay=1) () =
     match Sys.file_exists lock_name with
      `Yes -> Unix.sleep delay; wait ()

+ 1 - 1
src/messages.ml

@@ -107,7 +107,7 @@ let check_verbosity ~f function_number =
 (* Print debugging, information, important... messages *)
 let debug message =
     check_verbosity ~f:(fun () ->
-        let mess = (Time.now()|> Time.to_string) ^ " " ^ message ^ "\n" in
+        let mess = (Time.now() |> Time.to_string) ^ " " ^ message ^ "\n" in
         print ~color:Plum ~style:Underline mess
     ) 5
 ;;