                   (.put queue
                         (image-to-byte-buffer
                           img
-                          (byte-buffer (* n 2)))))))
+                          (byte-buffer (* n 2)))
+                        )
+                  )))
       queue)))
 
 (defn shorts-test [n]

          (future (.force channel true))))
    (.force channel false)
    (.close file)))

(defn acquire-and-save-test [n]
    (let [buffer-queue (time (simple-byte-buffer-queue n))
          filename (str "E:/acquisition/test" (rand-int 100000) ".dat")
          file (RandomAccessFile. filename "rw")
          channel (.getChannel file)
          t0 (System/currentTimeMillis)]
      (println filename)
      (dotimes [i n]
        (when (zero? (mod i 100))
          (println i (- (System/currentTimeMillis) t0)))
        (.write channel 
                (.take buffer-queue)
               )
        (when (zero? (mod i 100))
          (future (.force channel true)))
      )
      (.close file)
      filename))

(defn run-in-parallel [n f]
  (doall (apply pcalls (repeat n f))))
