mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 19:35:36 +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;
|
||||
}
|
||||
}
|
||||
|
||||
public void addItem(Object item) {
|
||||
//print("in addItem() - entering");
|
||||
synchronized (list) {
|
||||
|
@ -51,6 +52,15 @@ public class Queue {
|
|||
//print("in addItem() - leaving");
|
||||
}
|
||||
|
||||
public Object[] clearItems() {
|
||||
Object[] array;
|
||||
synchronized (list) {
|
||||
array = list.toArray();
|
||||
list.clear();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
private static void print(String msg) {
|
||||
String name = Thread.currentThread().getName();
|
||||
System.out.println(name + ": " + msg);
|
||||
|
|
Loading…
Add table
Reference in a new issue