main
commit
9cd6b547d9
|
|
@ -0,0 +1,20 @@
|
||||||
|
public class Barrier extends Thread{
|
||||||
|
|
||||||
|
public boolean stopped = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
while(!this.stopped) {
|
||||||
|
//System.out.println("Running!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws InterruptedException {
|
||||||
|
var thread = new Barrier();
|
||||||
|
thread.start();
|
||||||
|
Thread.sleep(1000);
|
||||||
|
thread.stopped = true;
|
||||||
|
thread.join();
|
||||||
|
System.out.println("Done!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
//public class Task extends Thread {
|
||||||
|
// public Task() {
|
||||||
|
// this.start();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// while (true) {
|
||||||
|
// System.out.println("Running");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
public class Titel {
|
||||||
|
Titel lock = null;
|
||||||
|
|
||||||
|
public synchronized void verb() {
|
||||||
|
|
||||||
|
synchronized (lock) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public synchronized void nomen() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue