Use this as an interface to the local manager thread.
This submits the task to the thread queue.
The thread will perform it when it's ready with other
waiting tasks.
509609
private synchronized void runTask(Task task) {
        if (taskThread == null) {
            taskThread = new TaskThread();
        }
        taskThread.runTask(task);
    }
546294
private void runInMainThread(Runnable runnable) {
        if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
            mHandler.post(runnable);
        } else {
            runnable.run();
        }
    }
448035
def handle(self):
        
        while True:
            # TODO: Queue.get() (and anything using thread.allocate_lock
            #       ignores signals :(  so timeout periodically to allow delivery
            try:
                callable = None # ensure no lingering references to past work while blocking
                callable = self._Q.get(True, 1.0)
            except Empty:
                continue  # retry on timeout
            try:
                if callable is self._stopit:
                    break
                callable()
            except:
                _log.exception("Error from WorkQueue")
            finally:
                self._Q.task_done()
561312
def put(self, task, args, kwargs):
        
        if self.num_threads == 0:
            return task(*args, **kwargs)
        if self.queue is None:
            self._spawn()
        self.queue.put((task, args, kwargs))
814750
@Override
	public T call() throws Exception {
		logger.debug("task '{}' starting", id);		
		try {
			// do the real work 
			return task.execute();
		} finally {
			// signal that the task is complete
			logger.debug("task '{}' is complete (queue size: {})", id, queue.size());
			queue.offer(id);			
		}
	}
924619
def submit(self, new_queue = None):
    """"""
    self.status = 'submitted'
    self.result = None
    self.machine_name = None
    if new_queue is not None:
      self.queue_name = new_queue
    for array_job in self.array:
      array_job.status = 'submitted'
      array_job.result = None
      array_job.machine_name = None
    self.submit_time = datetime.now()
    self.start_time = None
    self.finish_time = None
356022
private void submit(final Level level, final Object message, final Throwable t) {
        if (!m_logger.isEnabledFor(level)) return;

        if (m_asynchLoggerPool == null) {
            m_logger.log(level, message, t);
            return;
        }

        final Runnable runnableLoggingTask = createRunnableLoggingTask(level, message, t);
        try {
            m_asynchLoggerPool.submit(runnableLoggingTask).get();
        } catch (Exception e) {
            Throwables.propagate(e);
        }
    }
79459
def process(self):
        
        assert self.queue is not None
        while True:
            event = self.queue.get()
            if self.pre_process_event(event):
                self.invoke_handlers(event)
            self.queue.task_done()
294902
def __thread_started(self):
		
		if self.__task is None:
			raise RuntimeError('Unable to start thread without "start" method call')
		self.__task.start()
		self.__task.start_event().wait(self.__scheduled_task_startup_timeout__)
677808
def submit(self, __fun, *args, **kwargs):
    

    future = Future().bind(__fun, *args, **kwargs)
    self.enqueue(future)
    return future
422854
public void run() {
        Runnable r = null;
        while (true) {
            // Try to drain the maximum capacity of thread-local items, checking
            // whether any were available
            if (workQueue.drainTo(internalQueue, threadLocalItems) == 0) {
                // block until a work item is available
                try {
                    internalQueue.offer(workQueue.take());
                } catch (InterruptedException ie) {
                    throw new Error(ie);
                }
            }
            // Execute all of the thread-local items
            while ((r = internalQueue.poll()) != null)
                r.run();
        }
    }
553661
def submit_task(rel_path, cache_string, buffer):
    """"""
    global upload_queue
    global upload_thread
    upload_queue.put((rel_path, cache_string, buffer))

    if upload_thread is None or not upload_thread.is_alive():
        upload_thread = UploaderThread()
        upload_thread.start()
268343
def submit(self, method, method_args=(), method_kwargs={}, done_callback=None, done_kwargs={}, loop=None):
        '''
        
        '''
        _future = self.pool.submit(method, *method_args, **method_kwargs)
        self.current_id += 1
        if done_callback:
            _future.add_done_callback(lambda _f:done_callback(_f,loop,**done_kwargs))#done kwargs, hardcoded kwargs
        self.request_pool[self.current_id] = _future
        return self.current_id, _future
536909
final synchronized void invoke() {
        result = null;
        exception = null;
        try {
            result = call();
        } catch( Throwable e ) {
            exception = e;
        } finally {
        	done = true;
        }

        // let the calling thread know that we are done.
        notify();
    }
155395
def submit_tasks(self, wait=False):
        
        for task in self:
            task.start()

        if wait:
            for task in self: task.wait()
335652
private synchronized void maybeRun() {
        if (inprogress==null && pending!=null) {
            base.submit(new Callable<Void>() {
                @Override
                public Void call() throws Exception {
                    synchronized (AtmostOneTaskExecutor.this) {
                        // everyone who submits after this should form a next batch
                        inprogress = pending;
                        pending = null;
                    }

                    try {
                        inprogress.set(task.call());
                    } catch (Throwable t) {
                        LOGGER.log(Level.WARNING, null, t);
                        inprogress.setException(t);
                    } finally {
                        synchronized (AtmostOneTaskExecutor.this) {
                            // if next one is pending, get that scheduled
                            inprogress = null;
                            maybeRun();
                        }
                    }
                    return null;
                }
            });
        }
    }
50443
private <T> ForkJoinTask<T> externalSubmit(ForkJoinTask<T> task) {
        Thread t; ForkJoinWorkerThread w; WorkQueue q;
        if (task == null)
            throw new NullPointerException();
        if (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) &&
            (w = (ForkJoinWorkerThread)t).pool == this &&
            (q = w.workQueue) != null)
            q.push(task);
        else
            externalPush(task);
        return task;
    }