Bug 173995 [Progress] Switch progress monitoring to asyncExec
Create some code - it has 2 parts one is running in UI and one is code running in background. Call background code: workbench.getProgressService().busyCursorWhile(this); UI code is just updating user interface [-; Let's imagine that the background code has some synchronized section. It enters this synchronized section, and provides feedback to user using progress monitor. This synchronized is long running action. Also background thread/some other thread sent before/during background sync section some stuff to UI which also acquires this background thread lock. So what's the problem - when calling progress monitor AccumulatingProgressMonitor - this class acquires RunnableLock, but this RunnableLock has already been acquired by other UI runner (Display.asyncExec) when there was something to be sent to UI. The problem is generally about UI sync/asyncexec rules. I think that main problem is that AccumulatingProgressMonitor uses Display.syncExec in some parts. I think that any progressmonitor shouldn't acquire any lock and also shouldn't block processing anyhow, because this can cause such pains.
bundles/org.eclipse.jface/src/org/eclipse/jface/operation/AccumulatingProgressMonitor.java
/*******************************************************************************
 * Copyright (c) 2000, 2006 IBM Corporation and others.
 * 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.operation;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IProgressMonitorWithBlocking;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ProgressMonitorWrapper;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.widgets.Display;
/**
 * A progress monitor that accumulates <code>worked</code> and <code>subtask</code> 
 * calls in the following way by wrapping a standard progress monitor:
 * <ul>
 * <li> When a <code>worked</code> or <code>subtask</code> call occurs the first time,
 *		the progress monitor posts a runnable into the asynchronous SWT event queue.