X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.utils.thread%2Fsrc%2Forg%2Fsimantics%2Futils%2Fthreads%2FIThreadWorkQueue.java;h=b18e9a555893d404705cb1e113ca4495df13f278;hb=1dfeb7d5c49b1391cd9d877e1eddab18995cb151;hp=a7114f9442e81598ef473c58796dead445a11bdf;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/IThreadWorkQueue.java b/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/IThreadWorkQueue.java index a7114f944..b18e9a555 100644 --- a/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/IThreadWorkQueue.java +++ b/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/IThreadWorkQueue.java @@ -1,67 +1,67 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.utils.threads; - -/** - * IThreadAccess is an interface for thread context switching. - * - * TODO Yield that makes the thread do other tasks in queue - * - * @Todo Queue open method + QueueClosed exception - * @see SWTThread - * @see AWTThread - * @see CurrentThread - * @author Toni Kalajainen - */ -public interface IThreadWorkQueue { - - /** - * Execute runnable asynchronously. - *

- * Note! - * Do not call this method directly unless the instance has been wrapped with - * ThreadUtils.getBetterThreadAccess(), if not use ThreadUtils.asyncExec. - * - * - * @param runnable - * @return the thread that is processing the runnable or null if thread refused to accept event - */ - Thread asyncExec(Runnable runnable); - - /** - * Execute runnable synchronously. - * This invocation will block until runnable has been executed. - * Note! - * Do not call this method directly unless the instance has been wrapped with - * ThreadUtils.getBetterThreadAccess(), if not use ThreadUtils.syncExec. - * - * @param runnable - * @return true if thread accepted the event, false if not - */ - boolean syncExec(Runnable runnable); - - /** - * Is the current thread the same as this access - * @return true if current thread is the same as this queue uses - */ - boolean currentThreadAccess(); - - /** - * Get the thread. May return null if the thread has not been initialized. - * The returned thread may also change right after call if no runnables are - * in queue. - * - * @return thread or null - */ - Thread getThread(); - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.utils.threads; + +/** + * IThreadAccess is an interface for thread context switching. + * + * TODO Yield that makes the thread do other tasks in queue + * + * @Todo Queue open method + QueueClosed exception + * @see SWTThread + * @see AWTThread + * @see CurrentThread + * @author Toni Kalajainen + */ +public interface IThreadWorkQueue { + + /** + * Execute runnable asynchronously. + *

+ * Note! + * Do not call this method directly unless the instance has been wrapped with + * ThreadUtils.getBetterThreadAccess(), if not use ThreadUtils.asyncExec. + * + * + * @param runnable + * @return the thread that is processing the runnable or null if thread refused to accept event + */ + Thread asyncExec(Runnable runnable); + + /** + * Execute runnable synchronously. + * This invocation will block until runnable has been executed. + * Note! + * Do not call this method directly unless the instance has been wrapped with + * ThreadUtils.getBetterThreadAccess(), if not use ThreadUtils.syncExec. + * + * @param runnable + * @return true if thread accepted the event, false if not + */ + boolean syncExec(Runnable runnable); + + /** + * Is the current thread the same as this access + * @return true if current thread is the same as this queue uses + */ + boolean currentThreadAccess(); + + /** + * Get the thread. May return null if the thread has not been initialized. + * The returned thread may also change right after call if no runnables are + * in queue. + * + * @return thread or null + */ + Thread getThread(); + +}