         let label = "\(net!.labels[idx]) - \(prob*100)%"
         let workTime = NSDate().timeIntervalSinceDate(startTime)
         print("net.forward is done within \(workTime) sec")
+        objc_sync_enter(self.running)
+        self.running = false
+        objc_sync_exit(self.running)
 
         print("GoogLeNet: \(label)")
         dispatch_async(dispatch_get_main_queue(), {

            print("Frame #\(self.frameCount)")
        }*/
        self.frameCount++
        if self.frameCount % 100 != 1 {
            return
        }


        // Prepare output
        let out = AVCaptureVideoDataOutput()
        out.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: Int(kCVPixelFormatType_32BGRA)]
        out.alwaysDiscardsLateVideoFrames = true
        let queue = dispatch_queue_create("input frames queue", DISPATCH_QUEUE_SERIAL)
        out.setSampleBufferDelegate(self, queue:queue)
        if !session.canAddOutput(out) {
