TODO can this run async? if so no need to call get()
976420
@Override
    public void compact() throws DocumentStoreException {
        try {
            get(queue.submit(new CompactCallable(this.attachmentsDir)));
        } catch (ExecutionException e) {
            String message = "Failed to compact database";
            logger.log(Level.SEVERE, message, e);
            throw new DocumentStoreException(message, e.getCause());
        }
    }
791565
function async(callback)
{
  var isAsync = false;

  // check if async happened
  defer(function() { isAsync = true; });

  return function async_callback(err, result)
  {
    if (isAsync)
    {
      callback(err, result);
    }
    else
    {
      defer(function nextTick_callback()
      {
        callback(err, result);
      });
    }
  };
}
880554
protected void executeGetAsync(HttpCallback callback, String url, Object tag, StrParam... strParams) {
        Request.Builder builder = mBuilder.builderGet(url, strParams);
        async(builder, tag, callback);
    }
792555
def run(self):
        ""
        # load files from source directory
        files = self.get_files()

        # loop through each middleware
        for func in self.middleware:

            # call each one, ignoring return value
            func(files, self)

        # store and return the result
        self.files.update(files)
        return files
1335054
def _get_and_execute(self):
        
        try:
            work = self.queue.get(timeout=self.max_seconds_idle)
        except queue.Empty:
            # max_seconds_idle has been exhausted, exiting
            self.end_notify()
            return False
        else:
            self._work(work)
            self.queue.task_done()
            return True
593129
def run(self) -> None:
        """"""
        while self._running:
            try:
                future, function = self._tx.get(timeout=0.1)
            except Empty:
                continue

            try:
                LOG.debug("executing %s", function)
                result = function()
                LOG.debug("returning %s", result)
                self._loop.call_soon_threadsafe(future.set_result, result)
            except BaseException as e:
                LOG.exception("returning exception %s", e)
                self._loop.call_soon_threadsafe(future.set_exception, e)
1223509
async function tryExample () {

  // Migration scripts
  const migrations = {

    // Called only if no migration has ever executed
    async 'none' (db) {
      const {User} = db.resources

      // Migration scripts
      await User.each(async (user) => {
        const {username} = user
        await user.update({name: username, username: null})
      })
      /* ... */

      await db.updateVersion('1.0.0') // Update to next version
    },

    async '1.0.0' (db) {
      /* ... */
      await db.updateVersion('1.0.1')
    }
  }
  await db.migrate(migrations)
}
1168776
async function fetchRow(connection, query, params){

    // execute query
    const [result] = await _query(connection, query, params);

    // entry found ?
    if (result.length >= 1){
        // extract data
        return result[0];
    }else{
        return null;
    }
}
1149218
def _get_by_id_async(cls, id, parent=None, app=None, namespace=None,
                       **ctx_options):
    
    key = Key(cls._get_kind(), id, parent=parent, app=app, namespace=namespace)
    return key.get_async(**ctx_options)
1039984
function runNext() {
	if (this.locked) return false;

    var item = this.queue[0];
    if (!item) return false;

    if (item.exclusive) {
        if (this.running) return false;
        this.locked = true;
    }

    this.queue.shift();

    this.running++;

	var self = this;
	item.fn.call(item.ctx).then(function(res) {
		runDone.call(self, item, true, res);
	}, function(err) {
		runDone.call(self, item, false, err);
	});

	return true;
}
534777
function run(path, options) {
        var wait = !options || (options.wait !== false);
        if (wait && !_ready) {
            return runQueue.push([path, options]);
        }

        require(path, '/');
    }
1118486
async function () {

    const oThis = this
      , statusResponse = {chain: {value: false, utility: false}};

    // check geth status
    for (var chainName in statusResponse.chain) {
      var response = await oThis._gethStatus(chainName);
      if (response.isSuccess()) {
        statusResponse.chain[chainName] = true;
      } else {
        return Promise.resolve(response);
      }
    }

    return Promise.resolve(responseHelper.successWithData(statusResponse));

  }
479864
async def _async_get(self, session: aiohttp.ClientSession, *args, _async_timeout_seconds: int = 5,
                         **kwargs):
        """"""

        # Taken almost directly from the aiohttp tutorial
        with async_timeout.timeout(_async_timeout_seconds):
            async with session.get(*args, **kwargs) as response:
                return await response.json(), response.status
683565
function run(desc, data, callback) {
    if (callback.length === 2) {
        callItAsync(desc, data, callback)
    } else {
        callItSync(desc, data, callback)
    }
}
16164
async def async_run(self) -> None:
        
        self.main_task = self.loop.create_task(self.main())
        await self.main_task
326633
async function run() {
  console.log(`\u{1f52c}  Searching for modules inside "${chalk.dim(SRC_DIR)}".`);
  const files = glob.sync('!(index)*.js', { cwd: SRC_DIR });
  const typings = files.map(file => createIconTyping(file));
  await Promise.all([...typings, createIndexTyping(files)]);
  console.log(`\u{1F5C4}  Written typings to ${chalk.dim(TARGET_DIR)}.`);
}
1219234
async function execTasks(tasks, taskType) {
  debug(`execTasks: called for ${taskType}`);
  if (!(_.isEmpty(tasks))) {
    if (taskType) console.log(`running ${taskType}...`);
    const output = await Promise.mapSeries(tasks, async(task) => {
      const result = await execTask(task);
      if (_.isString(result.stdout) && (!_.isEmpty(result.stdout)))
        console.log(result.stdout.trim());
      if (_.isString(result.stderr) && (!_.isEmpty(result.stderr)))
        console.log(result.stderr.trim());
      return result;
    });
    return output;
  }
  debug("execTasks: nothing to do; resolving");
  return;
}