]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/widgets/RunnableLock.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / widgets / RunnableLock.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.widgets;
15
16
17 /**
18  * Instances of this class are used to ensure that an
19  * application cannot interfere with the locking mechanism
20  * used to implement asynchronous and synchronous communication
21  * between widgets and background threads.
22  */
23
24 class RunnableLock {
25         Runnable runnable;
26         Thread thread;
27         Throwable throwable;
28
29 RunnableLock (Runnable runnable) {
30         this.runnable = runnable;
31 }
32
33 boolean done () {
34         return runnable == null || throwable != null;
35 }
36
37 void run (Display display) {
38         if (runnable != null) {
39                 try {
40                         runnable.run ();
41                 } catch (RuntimeException exception) {
42                         display.getRuntimeExceptionHandler ().accept (exception);
43                 } catch (Error error) {
44                         display.getErrorHandler ().accept (error);
45                 }
46         }
47         runnable = null;
48 }
49
50 }