mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
new method clearItems()
This commit is contained in:
parent
64213165e0
commit
aa81471656
1 changed files with 10 additions and 0 deletions
|
@ -35,6 +35,7 @@ public class Queue {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItem(Object item) {
|
public void addItem(Object item) {
|
||||||
//print("in addItem() - entering");
|
//print("in addItem() - entering");
|
||||||
synchronized (list) {
|
synchronized (list) {
|
||||||
|
@ -51,6 +52,15 @@ public class Queue {
|
||||||
//print("in addItem() - leaving");
|
//print("in addItem() - leaving");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object[] clearItems() {
|
||||||
|
Object[] array;
|
||||||
|
synchronized (list) {
|
||||||
|
array = list.toArray();
|
||||||
|
list.clear();
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
private static void print(String msg) {
|
private static void print(String msg) {
|
||||||
String name = Thread.currentThread().getName();
|
String name = Thread.currentThread().getName();
|
||||||
System.out.println(name + ": " + msg);
|
System.out.println(name + ": " + msg);
|
||||||
|
|
Loading…
Add table
Reference in a new issue