129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2006 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.text.ISynchronizable;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17 /**
|
|
18 * Interface for text related objects which may be used in the multi-threaded
|
|
19 * context and thus must provide a way to prevent concurrent access and
|
|
20 * manipulation.
|
|
21 * <p>
|
|
22 * In order to reduce the probability of dead locks clients should synchronize
|
|
23 * their access to these objects by using the provided lock object rather than
|
|
24 * the object itself.</p>
|
|
25 * <p>
|
|
26 * Managing objects can use the <code>setLockObject</code> method in order to
|
|
27 * synchronize whole sets of objects.</p>
|
|
28 *
|
|
29 * @since 3.0
|
|
30 */
|
|
31 public interface ISynchronizable {
|
|
32
|
|
33 /**
|
|
34 * Sets the lock object for this object. If the lock object is not
|
|
35 * <code>null</code> subsequent calls to specified methods of this object
|
|
36 * are synchronized on this lock object. Which methods are synchronized is
|
|
37 * specified by the implementer.
|
|
38 * <p>
|
|
39 * <em>You should not override an existing lock object unless you own
|
|
40 * that lock object yourself. Use the existing lock object instead.</em>
|
|
41 * </p>
|
|
42 *
|
|
43 * @param lockObject the lock object. May be <code>null</code>.
|
|
44 */
|
|
45 void setLockObject(Object lockObject);
|
|
46
|
|
47 /**
|
|
48 * Returns the lock object or <code>null</code> if there is none. Clients
|
|
49 * should use the lock object in order to synchronize concurrent access to
|
|
50 * the implementer.
|
|
51 *
|
|
52 * @return the lock object or <code>null</code>
|
|
53 */
|
|
54 Object getLockObject();
|
|
55 }
|