Helper method for running the monitor recursively one time.

 @yield
506286
def run_recursively(monitor, directory, *flags, &block)
      result = watch_and_run(monitor, 1, true, directory, *flags, &block)
      result.changes[0].directory = result.directory
      result.changes[0]
    end
658490
def rerun(self):

        

        self._state = states.SCHEDULING
        self._completed_flag = threading.Event()
        print 'Pipeline %s in %s state'%(self._uid, self._state)
1217199
def _run_once(runner_list, extra_tick, use_poll):
    
    if len(runner_list) > 0:
        asyncore.loop(0, use_poll, None, 1)
        for runner in runner_list:
            if not runner.tick():
                return runner
    if extra_tick is not None:
        code = extra_tick()
        if code is False:
            return False
    return True
373370
def run_once(func):
    

    def _inner(*args, **kwargs):
        if func.__name__ in CTX.run_once:
            LOGGER.info('skipping %s', func.__name__)
            return CTX.run_once[func.__name__]

        LOGGER.info('running: %s', func.__name__)
        result = func(*args, **kwargs)
        CTX.run_once[func.__name__] = result
        return result

    return _inner
1297460
private void sawIINC(int pc) {
        int reg = getRegisterOperand();
        if (!ignoreRegs.get(reg)) {
            ScopeBlock sb = findScopeBlock(rootScopeBlock, pc);
            if (sb != null) {
                sb.addLoad(reg, pc);
            } else {
                ignoreRegs.set(reg);
            }
        }
        if (catchHandlers.get(pc)) {
            ignoreRegs.set(reg);
        } else if (!monitorSyncPCs.isEmpty()) {
            ignoreRegs.set(reg);
        } else if (sawNull) {
            ignoreRegs.set(reg);
        }

        if (!ignoreRegs.get(reg)) {
            ScopeBlock sb = findScopeBlock(rootScopeBlock, pc);
            if (sb != null) {
                sb.addStore(reg, pc, null);
                if (sawDup) {
                    sb.addLoad(reg, pc);
                }
            } else {
                ignoreRegs.set(reg);
            }
        }
    }
962736
def execute_once(self):
        """"""
        symbol = self.tape.get(self.head, self.EMPTY_SYMBOL)

        index = self.alphabet.index(symbol)
        rule = self.states[self.state][index]

        if rule is None:
            raise RuntimeError('Unexpected symbol: ' + symbol)

        self.tape[self.head] = rule[0]

        if rule[1] == 'L':
            self.head -= 1
        elif rule[1] == 'R':
            self.head += 1

        self.state = rule[2]
1010262
def start(self, *args, **kwargs):
        
        if self.is_running():
            raise RuntimeError('Already started')
        self._running = self.run(*args, **kwargs)
        try:
            yielded = next(self._running)
        except StopIteration:
            raise TypeError('run() must yield just one time')
        if yielded is not None:
            raise TypeError('run() must yield without value')
227844
def run(self, once=True):
        
        print("\n- Actor %s " % self.name)
        for m in self.submons:
            res = m.monitor(once=once)
            print("   | Submonitor %s : %s" % (self.name, res))
            # print("%s %s %s %s lst %s" % (self.name, m.fid, m.last, m.counter, m.last))
            self.get_kv().update(KVector.Entry(m.fid, agent=self.name, value=m.last, timestamp=m.counter))
        res = self.monitor.monitor(once=once)
        print("  Main monitor %s : %s" % (self.name, res))
608938
def watch_and_run(monitor, times, recursively, directory, *flags)
      result = OpenStruct.new(directory: directory, changes: [])
      i = 0
      result.changes[i] = OpenStruct.new(called: false)
      can_return = false
      callback = Proc.new do |change|
        next if can_return

        result.changes[i].called = true;
        result.changes[i].change = change

        i += 1

        if i < times
          result.changes[i] = OpenStruct.new(called: false)
        else
          can_return = true
        end
      end

      if recursively
        monitor.watch_recursively(directory, *flags, &callback)
      else
        monitor.watch(directory, *flags, &callback)
      end

      thread = Thread.new(monitor) { |m| m.run! }
      sleep(0.2) # give time for the monitor to bootup

      yield # So much boilerplate code to get here :S

      sleep(0.2) # allow the monitor to run the callbacks

      # Nothing can change after the callback if there is only one of them,
      # so never wait for one callback
      if times > 1
        until can_return
          sleep(0.1)
        end
      end

      return result
    ensure
      monitor.stop
      thread.join if thread
    end
1076426
@Override
    public void run() {

        try {

            // Set up
            Path path = FileSystems.getDefault().getPath(this.path);
            watcher = FileSystems.getDefault().newWatchService();
            Scanner.start(path, watcher);

            while (true) {

                // Reload when notified
                synchronized (this) {
                    this.wait();
                }

                // Keep reloading until all changes have notified:
                while (reloadRequested) {
                    reloadRequested = false;
                    Reflections reflections = ClassFinder.newReflections();
                    ApiHandler.setupApi(reflections);
                    Main.mainHandler.setupFilters(reflections);
                    Main.mainHandler.runStartups(reflections);
                }

            }

        } catch (IOException | InterruptedException e) {
            try {
                shutdown();
                throw new RuntimeException("Error in " + ClassReloader.class.getSimpleName() + ", exiting.", e);
            } catch (IOException e1) {
                e.printStackTrace();
            }
        }

    }
996707
def visit_RETURN(self, node):
        
        if len(node.children) == 2:
            node.children[1] = (yield ToVisit(node.children[1]))
        yield node
822889
def run_and_collect_multiple_changes(monitor, times, directory, *flags, &block)
      watch_and_run(monitor, times, false, directory, *flags, &block)
    end
742985
function() {
            // run iterator for this item
            iterator(arr[current], function(err) {
                // check for any errors with this element
                if (err) {
                    callback(err, yielded);
                } else {
                    // move onto the next element
                    current++;

                    if (current === arr.length) {
                        // all done
                        callback(null, yielded);
                    } else {
                        var now = +(new Date());

                        // check if we need to take a break at all
                        if (now > endTime) {
                            // reset start and end time
                            startTime = now;
                            endTime = startTime + workTime;

                            yielded = true;

                            // prioritize setImmediate
                            if (immediate) {
                                immediate(function() {
                                    iterate();
                                });
                            } else {
                                // if we're not doing an immediate yield, also add yield time
                                endTime += yieldTime;

                                setTimeout(function() {
                                    iterate();
                                }, yieldTime);
                            }
                        } else {
                            // work on the next item immediately
                            iterate();
                        }
                    }
                }
            });
        }
768923
def in_order(self) -> Iterator["BSP"]:
        
        if self.children:
            yield from self.children[0].in_order()
            yield self
            yield from self.children[1].in_order()
        else:
            yield self
968464
public void performFinish(IProgressMonitor monitor) throws CoreException, InterruptedException {
		final SubMonitor subMonitor = SubMonitor.convert(monitor, 4);
		try {
			monitor.beginTask(NewWizardMessages.NewJavaProjectWizardPageTwo_operation_create, 3);
			if (this.currProject == null) {
				updateProject(subMonitor.newChild(1));
			}

			final String newProjectCompliance = this.keepContent ? null : this.firstPage.getCompilerCompliance();
			configureJavaProject(newProjectCompliance, subMonitor.newChild(1));
		} catch (Throwable e) {
			if (this.currProject != null) {
				removeProvisonalProject();
			}
			throw e;
		} finally {
			subMonitor.done();
			this.currProject = null;
			if (this.isAutobuild != null) {
				CoreUtility.setAutoBuilding(this.isAutobuild.booleanValue());
				this.isAutobuild = null;
			}
		}
	}
850359
public void getChildren(String path, boolean watch, ChildrenCallback cb,
            Object ctx) {
        verbotenThreadCheck();
        getChildren(path, watch ? watchManager.defaultWatcher : null, cb, ctx);
    }
128644
def each
      child_after = 0
      while (child_after = FindWindowEx(@parent.handle, child_after, nil, nil)) > 0 do
        window = Window.new child_after
        # immediate children only
        yield window if (window.parent) && (window.parent.handle == @parent.handle)
      end
    end